---
title: "Batch assign/unassign card definitions"
method: POST
path: "/v2/loyalties/programs/{programId}/card-definitions/batch"
tags: ["Programs"]
---

# Batch assign/unassign card definitions

`POST /v2/loyalties/programs/{programId}/card-definitions/batch`

<Info>

<Badge color="gray">Documentation in progress</Badge>

This documentation is in progress. The parameters, fields, request and response bodies, and other data may be subject to change. If you need more information or you want to share feedback, contact [Voucherify support](https://www.voucherify.io/contact-support) or your Technical Account Manager.

</Info>

Assigns and/or unassigns card definitions to/from a program in a single batch.
Unassign operations are processed before assign operations.
The program must be in `DRAFT` status - otherwise the request is rejected with
`423 Locked` (key `non_draft_program`). In strict mode (default) missing card
definitions, inactive card definitions or missing assignments cause the whole
batch to fail.

## Path parameters

- `id` string, required

## Request body

- ProgramCardDefinitionBatchRequest — Batch of card definition assignment operations. `unassign` operations are processed before `assign` operations. Duplicate ids within a batch are rejected.
  - `assign` ProgramCardDefinitionAssignItem[], nullable — Card definitions to assign.
    - `id` string, required — Unique card definition identifier.
  - `unassign` ProgramCardDefinitionUnassignItem[], nullable — Card definitions to unassign.
    - `id` string, required — Unique card definition identifier.

## Response `200`

Batch processing result.

- ProgramCardDefinitionBatchResponse — Result of a card definition assignment batch. Keys are null when the corresponding operation list was not provided.
  - `assigned` ProgramCardDefinitionAssignment[], nullable — Assignments created by the batch, or `null` when no assign operations were requested.
    - `card_type` 'INDIVIDUAL' — Card type of the assigned card definition.
    - `card_definition_id` string — Unique card definition identifier.
    - `created_at` string, date-time — Assignment creation timestamp (ISO 8601).
    - `object` 'program_card_definition' — Object type marker.
  - `unassigned` ProgramCardDefinitionAssignment[], nullable — Assignments removed by the batch, or `null` when no unassign operations were requested.
    - `card_type` 'INDIVIDUAL' — Card type of the assigned card definition.
    - `card_definition_id` string — Unique card definition identifier.
    - `created_at` string, date-time — Assignment creation timestamp (ISO 8601).
    - `object` 'program_card_definition' — Object type marker.

## Other responses

- `400` — Validation error - request body or query parameters failed validation, or the operation is not allowed in the current resource state.
- `404` — Resource not found.
- `409` — Conflict - e.g. duplicate resource or invalid state transition.
- `423` — Resource locked - a related resource is in a state that prevents this operation.
- `500` — Internal server error.

---

[API](https://skmtc.net/voucherifyio/apis/voucherify-loyalty-v2-api.md) · [All operations](https://skmtc.net/voucherifyio/apis/voucherify-loyalty-v2-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/voucherifyio/voucherify-loyalty-v2-api/revisions/69be73b5cff0/schema)
