> For the complete documentation index, see [llms.txt](https://api-docs.rightsline.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.rightsline.com/batch/overview/batch-structure.md).

# Batch structure

Every batch has the following fields:

**batchId** (int) - The Batch ID.

**batchStatus** (string) - The [Batch status](/batch/overview/batch-statuses.md).

**batchResults** (object) - The [record](#batch-records) and [relationship](#batch-relationships) objects that are the result of the batch.&#x20;

```json
{
    "batchId": Int,
    "batchStatus": "Created"/"InProgress"/"Errored"/"Cancelled"/"Complete",
    "batchResults": {
        "records": {EntityObjectDictionary},
        "relationships": [RelationshipObject]
    }
}
```

### Batch records

Batch records are organized in a key-value collection, where the records are grouped by the char type ID.  For example, the following JSON contains four records, two contacts (char type ID = 2) and two catalog items (char type ID = 1).

```json
{
    "records": {
        "2": [
            {
                "characteristics": {
                    "department": "Sales",
                    "first_name": "John",
                    "last_name": "Smith"
                },
                "template": {
                    "templateId": 1
                },
                "title": "Person 1"
            },
            {
                "characteristics": {
                    "department": "Accounting",
                    "first_name": "Susan",
                    "last_name": "Williams"
                },
                "template": {
                    "templateId": 1
                },
                "title": "Person 2"
            }
        ],
        "1": [
            {
                "characteristics": {
                    "release_year": 2006
                },
                "template": {
                    "templateId": 1
                },
                "title": "Catalog 1"
            },
            {
                "characteristics": {
                    "release_year": 2013
                },
                "template": {
                    "templateId": 1
                },
                "title": "Catalog 2"
            }
        ]
    }
}
```

When retrieving a batch, the records will be organized in a slightly different structure. The records will still be organized in a key-value collection by char type ID, but each individual entity will have a few new fields:

**record** (object) - The entity object.

**code** (int) - The HTTP status code indicating the status of creating/updating/deleting/retrieving the record. Examples are 200, 400, 403, 404, 409

&#x20;**message** (int) - A human-readable message of the status of the batch record. Examples would be "Found.", "Created.", "Updated.", "Deleted.", "Action Executed.", "Copied.", "Record Not Found.", "Access Denied.", "Invalid Record.", "Record Locked."&#x20;

**id** (int) - The ID of the record.

```json
 "records": {
    "1": [
        {
            "record": {
                "id": 5,
                "revisionId": 0,
                "title": "test",
                "template": {
                    "templateId": 1,
                    "templateName": "Feature",
                    "processId": 0
                },
                "status": {
                    "statusId": 19,
                    "statusName": "Inactive, Not Deletable, Locked"
                },
                "characteristics": {
                    "notes": [
                        "test"
                    ]
                },
                "createdById": 46232,
                "createdDate": "2015-09-03T00:59:01.507Z",
                "lastUpdatedById": 1100491,
                "lastUpdatedDate": "2023-02-14T18:30:19.857Z",
                "statusUpdatedById": 1100491,
                "statusUpdatedDate": "2020-12-11T17:51:50.830Z"
            },
            "code": 200,
            "message": "Found.",
            "id": 5
        }
    ]
}
```

### Batch relationships

```json
{
    "relationships":[
        {
            "parentCharTypeId": 4,
            "parentRecordId": 4958,
            "childCharTypeId": 1,
            "childRecordId": 23456
        },
        {
            "parentCharTypeId": 4,
            "parentRecordId": 4958,
            "childCharTypeId": 2,
            "childRecordId": 12345
        }
    ]
}
```

When retrieving a batch, the relationships will take on a similar structure as the records in the response, containing the additional fields below:

**relationship**(object) - The relationship object.

**code** (int) - The HTTP status code indicating the status of creating/deleting/retrieving the relationship. Examples are 200, 400, 403, 404, 409

&#x20;**message** (int) - A human-readable message of the status of the batch record. Examples would be "Found.", "Created.", "Deleted.", "Access Denied."&#x20;

**id** (int) - The ID of the relationship.

```json
"relationships": [
    {
        "relationship": {
            "id": 431235011,
            "relationshipType": {
                "relationshipTypeId": 0,
                "relationshipTypeName": "Default"
            },
            "createdById": 1091106,
            "createdDate": "2020-07-10T20:24:34.263Z",
            "lastUpdatedById": 1091106,
            "lastUpdatedDate": "2020-07-10T20:24:34.263Z",
            "parentCharTypeId": 4,
            "parentRecordId": 1493,
            "childCharTypeId": 1,
            "childRecordId": 8327,
            "sequenceNumber": 1602064027648
        },
        "code": 200,
        "message": "Found.",
        "id": 431235011
    }
]
```


---

# 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://api-docs.rightsline.com/batch/overview/batch-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.
