> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/classic-tokenization/use-cases/synchronize-tokens-using-batch-files/batch-file-json-schema.md).

# Batch file JSON schema

Use these JSON Schema definitions to validate batch files used for token synchronization.

For a human-readable field reference and examples, see:

* [Batch file structure](/classic-tokenization/use-cases/synchronize-tokens-using-batch-files/batch-file-structure.md)
* [Output batch file structure](/classic-tokenization/use-cases/synchronize-tokens-using-batch-files/output-batch-file-structure.md)
* [Error codes table](/classic-tokenization/use-cases/synchronize-tokens-using-batch-files/error-codes-table.md)

{% hint style="info" %}
These schemas target JSON Schema draft 2020-12.

Some validators may treat the `nullable` keyword as non-standard. Validate with the tooling you use in your issuer backend.
{% endhint %}

### Input batch file schema <a href="#input-batch-file" id="input-batch-file"></a>

#### Virtual card registration <a href="#virtual-card-registration" id="virtual-card-registration"></a>

Use this schema to validate an input file where:

* `header.operation` is `VIRTUAL_CARD_REGISTRATION`.
* Each record contains `rowId` and `virtualCardRegistrationRequest.card`.
* `signature` is a detached JWS (see [Batch file structure](/classic-tokenization/use-cases/synchronize-tokens-using-batch-files/batch-file-structure.md)).

{% code title="input-virtual-card-registration.schema.json" %}

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "header": {
      "type": "object",
      "properties": {
        "batchId": { "type": "string", "nullable": false },
        "seqNumber": { "type": "string", "nullable": false },
        "operation": {
          "type": "string",
          "enum": ["VIRTUAL_CARD_REGISTRATION"]
        },
        "issuerId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "batchId",
        "seqNumber",
        "operation",
        "issuerId"
      ]
    },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "rowId": {
            "type": "integer"
          },
          "virtualCardRegistrationRequest": {
                "type": "object",
                "properties": {
                    "card": {
                        "type": "object",
                        "required": ["id", "scheme", "encryptedData"],
                        "properties": {
                            "id": { "type": "string", "nullable": false },
                            "scheme": { "type": "string", "enum": ["MASTERCARD", "VISA"] },
                            "encryptedData": { "type": "string" }
                        }
                    }
                },
                "required": ["card"],
                "additionalProperties": false
            }
        },
        "required": [
          "rowId",
          "virtualCardRegistrationRequest"
        ]
      },
      "additionalItems": false
    },
    "signature": { "type": "string", "nullable": false, "minLength": 1 }
  },
  "additionalProperties": false,
  "required": [
    "header",
    "records",
    "signature"
  ]
}
```

{% endcode %}

### Output batch file schema <a href="#output-batch-file" id="output-batch-file"></a>

#### Virtual card registration result <a href="#virtual-card-registration-result" id="virtual-card-registration-result"></a>

Use this schema to validate the output results file produced after processing an input batch file.

{% code title="output-virtual-card-registration.schema.json" %}

```json
{
    "type": "object",
    "properties": {
        "header": {
            "type": "object",
            "properties": {
                "batchId": { "type": "string" },
                "seqNumber": { "type": "string" },
                "operation": { "type": "string", "enum": ["VIRTUAL_CARD_REGISTRATION"] },
                "issuerId": { "type": "string", "minLength": 10, "maxLength": 10 },
                "errorCode": { "type": "string" },
                "totalRecords": { "type": "integer" }
            },
            "additionalProperties": false
        },
        "recordsResults": {
            "type": "array",
            "items": [
                {
                    "type": "object",
                    "properties": {
                        "rowId": {
                            "type": "integer"
                        },
                        "virtualCardRegistrationResult": {
                            "type": "object",
                            "properties": {
                                "card": {
                                  "type": "object",
                                  "properties": {
                                    "id": { "type": "string" },
                                    "status": { "type": "string" },
                                    "digitalCardIds": {
                                        "type": "array",
                                        "items": [
                                          {
                                            "type": "string"
                                          }
                                        ]
                                    }
                                    "errorCode": { "type": "string" }
                                  },
                                  "required": ["id", "status"],
                                  "additionalProperties": false
                                },
                                "errorCode": { "type": "string" },
                                "status": { "type": "string" }
                            },
                            "required": ["card"],
                            "additionalProperties": false
                        }
                    },
                    "required": ["rowId", "virtualCardRegistrationResult"]
                }
            ]
        }
    },
    "required": ["header"],
    "additionalProperties": false
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/classic-tokenization/use-cases/synchronize-tokens-using-batch-files/batch-file-json-schema.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
