> ## Documentation Index
> Fetch the complete documentation index at: https://docs.userecord.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Issue Credentials

> Issue verifiable credentials to one or more recipients under a programme.

## Overview

Creates a new **credential batch** and issues a unique, shareable credential URL to each recipient. The batch is immediately queryable via [Get Credential Batch](/api-reference/issuance/get-batch).

<Note>
  Requires `Content-Type: application/json` and a valid API token. All recipients in a batch are tied to the same programme.
</Note>

***

## Request Body

| Field                | Type   | Required | Description                              |
| -------------------- | ------ | -------- | ---------------------------------------- |
| `programId`          | string | Yes      | The programme to issue credentials under |
| `batchName`          | string | Yes      | A label for this batch of credentials    |
| `recipients`         | array  | Yes      | One or more recipient objects            |
| `recipients[].name`  | string | Yes      | Recipient full name                      |
| `recipients[].email` | string | Yes      | Recipient email address                  |

***

## Response Fields

| Field                        | Type   | Description                                                     |
| ---------------------------- | ------ | --------------------------------------------------------------- |
| `batchId`                    | string | Unique batch identifier — use with `GET /credentials/{batchId}` |
| `programId`                  | string | Programme this batch belongs to                                 |
| `batchName`                  | string | Name given to this batch                                        |
| `orgId`                      | string | Organisation                                                    |
| `mode`                       | string | `"live"` or `"test"`                                            |
| `status`                     | string | Always `"issued"` on creation                                   |
| `recipients`                 | array  | Array of issued credentials                                     |
| `recipients[].recipientId`   | string | Unique credential ID per recipient                              |
| `recipients[].credentialUrl` | string | Public URL to view the credential                               |
| `issuedAt`                   | string | ISO 8601 timestamp                                              |

***

## Error Codes

| Code                 | HTTP | Description                                          |
| -------------------- | ---- | ---------------------------------------------------- |
| `MISSING_PROGRAM_ID` | 400  | `programId` missing from request body                |
| `MISSING_BATCH_NAME` | 400  | `batchName` missing from request body                |
| `MISSING_RECIPIENTS` | 400  | `recipients` missing or empty array                  |
| `UNAUTHORIZED`       | 401  | Token missing or invalid                             |
| `NOT_FOUND`          | 404  | `programId` does not exist or belongs to another org |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.getrecord.in/api/external/issuance/credentials \
    --header 'Authorization: Bearer sk_test_your_token_here' \
    --header 'Content-Type: application/json' \
    --data '{
      "programId": "prog_1779172339924_j3pr93",
      "batchName": "May 2025 Cohort",
      "recipients": [
        {
          "name": "Alice Johnson",
          "email": "alice@example.com"
        },
        {
          "name": "Bob Smith",
          "email": "bob@example.com"
        }
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "success": true,
    "message": "Credentials issued successfully",
    "data": {
      "batchId": "batch_1779353381048_e3ixqz",
      "programId": "prog_1779172339924_j3pr93",
      "batchName": "May 2025 Cohort",
      "orgId": "org_1779085658651_hmhfv5",
      "mode": "test",
      "status": "issued",
      "recipients": [
        {
          "recipientId": "rec_1779353381048_ab12cd",
          "name": "Alice Johnson",
          "email": "alice@example.com",
          "credentialUrl": "https://app.getrecord.in/credential/rec_1779353381048_ab12cd"
        },
        {
          "recipientId": "rec_1779353381049_ef34gh",
          "name": "Bob Smith",
          "email": "bob@example.com",
          "credentialUrl": "https://app.getrecord.in/credential/rec_1779353381049_ef34gh"
        }
      ],
      "issuedAt": "2025-05-21T08:09:41.048Z"
    }
  }
  ```
</ResponseExample>
