> 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/tokenization/es/register-cards-via-batch-file/batch-file-output-structure.md).

# Estructura de salida del archivo por lotes

This page describes the JSON output file generated after a batch input file is processed.

The output file structure is similar to the input batch file and contains one header object and an array of record-level results.

## Output file structure

| Name           | Type   | Size | M/O/C | Description                                                                                                                                                |
| -------------- | ------ | ---- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| header         | Object | -    | M     | Summary of the batch processing result.                                                                                                                    |
| recordsResults | Array  | -    | C     | Array of record results. Each entry contains the result of one operation. This array is present only when no error is detected at the file (header) level. |

### Header object

The `header` object has the following structure:

| Name         | Type    | Size | M/O/C | Description                                                                                                                                                                                                                                    |
| ------------ | ------- | ---- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| batchId      | String  | 48   | M     | Identifier of the batch file. This value is copied from the `batchId` field in the input file header.                                                                                                                                          |
| seqNumber    | String  | 48   | M     | Sequence number of the batch file. This value is copied from the `seqNumber` field in the input file header.                                                                                                                                   |
| issuerId     | String  | 10   | M     | Identifier of the issuer.                                                                                                                                                                                                                      |
| operation    | String  | 48   | M     | Operation executed for this batch file. This value is copied from the `operation` field in the input file header.                                                                                                                              |
| totalRecords | Integer | N/A  | C     | Number of records included in the report. This field is present only when no error is detected at the file (header) level.                                                                                                                     |
| errorCode    | String  | 3    | C     | Error code returned when an error is detected at the file (header) level. For details, see [Batch file error handling](https://app.gitbook.com/o/fwy1mtbRONGA2YDKDBr0/s/62lLFDcmLCeqqwmy4Fee/integrate-batch-files/batch-file-error-handling). |

### Record results

Each item in the `recordsResults` array has the following structure:

| Name                           | Type    | Size | M/O/C | Description                                                        |
| ------------------------------ | ------- | ---- | ----- | ------------------------------------------------------------------ |
| rowId                          | Integer | -    | M     | Row identifier. This value is the same as in the input batch file. |
| consumerCardRegistrationResult | Object  | -    | M     | Result of the end user and card registration for this record.      |

#### `consumerCardRegistrationResult` object

| Name              | Type                   | Size   | M/O/C | Description                                                                                                                                               |
| ----------------- | ---------------------- | ------ | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| consumerId        | String                 | 1...64 | M     | Unique identifier of the end user (consumer).                                                                                                             |
| consumerStatus    | String                 | 2      | M     | Enum: `OK`, `KO`. `OK` means the end user record was successfully processed. `KO` means the end user record processing failed.                            |
| cards             | Array of card (Object) | N/A    | M     | Array that contains the result for each card associated with this end user.                                                                               |
| consumerError     | String                 | N/A    | C     | Additional error description, when available. For example, it may identify the field with an invalid format. This field is only present in case of error. |
| consumerErrorCode | String                 | N/A    | C     | Error code returned when `consumerStatus` is `KO`.                                                                                                        |

#### **`card` object**

Each `card` element in the `cards` array has the following structure:

| Name           | Type            | Size   | M/O/C | Description                                                                                                                                                                                                                                      |
| -------------- | --------------- | ------ | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id             | String          | 1...48 | M     | Unique identifier that the issuer assigns to the card.                                                                                                                                                                                           |
| status         | String          | 2      | M     | Enum: `OK`, `KO`. `OK` means the card record was successfully processed. `KO` means the card record processing failed.                                                                                                                           |
| digitalCardIds | Array of String | N/A    | O     | Present only for digital card migration or registration. Lists all digital card IDs successfully registered in D1 for the given card. Applicable only when the input file header `operation` is `CONSUMER_CARD_REGISTRATION_WITH_DIGITAL_CARDS`. |
| error          | String          | N/A    | C     | Additional error description, when available. For example, it may identify the field with an invalid format. This field is only present in case of error.                                                                                        |
| errorCode      | String          | N/A    | C     | Error code returned when `status` is `KO`. For details, see [Batch file error handling](https://app.gitbook.com/o/fwy1mtbRONGA2YDKDBr0/s/62lLFDcmLCeqqwmy4Fee/integrate-batch-files/batch-file-error-handling).                                  |

## Batch file example

The following example shows an output file with two end users successfully registered. The first end user has no cards. The second end user has one card, but the card credentials provided in the input batch file were not correctly encrypted, so the card registration failed.

```json
{
  "header": {
    "batchId": "52bxaby7dw",
    "seqNumber": "001",
    "operation": "CONSUMER_CARD_REGISTRATION",
    "issuerId": "d1power001",
    "totalRecords": 2
  },
  "recordsResults": [
    {
      "rowId": 0,
      "consumerCardRegistrationResult": {
        "consumerId": "pie000010200000000000035",
        "consumerStatus": "OK",
        "cards": []
      }
    },
    {
      "rowId": 1,
      "consumerCardRegistrationResult": {
        "consumerId": "pie000010200000000000036",
        "consumerStatus": "OK",
        "cards": [
          {
            "id": "ZzLTT3m7St7VPYFrrVKvzL",
            "status": "KO",
            "errorCode": "CRYPTO_ERROR",
            "error": "Error while decrypting data."
          }
        ]
      }
    }
  ]
}
```


---

# 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:

```
GET https://docs.payments.thalescloud.io/tokenization/es/register-cards-via-batch-file/batch-file-output-structure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
