Reassign a document schema
Pin a published schema version onto one batch document.
curl --request POST \
--url https://api.example.com/api/v2/batches/{batch_id}/documents/{doc_id}/version/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version_number": 2
}
'import requests
url = "https://api.example.com/api/v2/batches/{batch_id}/documents/{doc_id}/version/"
payload = { "version_number": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({version_number: 2})
};
fetch('https://api.example.com/api/v2/batches/{batch_id}/documents/{doc_id}/version/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 123,
"version_number": 1073741823,
"published_at": "2023-11-07T05:31:56Z",
"published_by": {
"id": 123,
"email": "jsmith@example.com"
},
"field_count": 123,
"is_deprecated": true,
"deprecated_by": {
"id": 123,
"email": "jsmith@example.com"
},
"pinned_field_ids": [
"<string>"
],
"output_language": "<string>",
"output_language_label": "<string>",
"output_language_is_rtl": true,
"source_languages": [
"<string>"
],
"source_language_labels": [
"<string>"
],
"publish_note": "<string>",
"deprecated_at": "2023-11-07T05:31:56Z",
"deprecation_note": "<string>"
}{}{}{}BatchDocument. Does not extract by itself — follow with Reprocess if you want a fresh run.Authorizations
Body
Response
Response shape for POST /api/v2/batches/{id}/documents/{doc_id}/version/.
Extends the summary with id (so the grid can repoint
row.struct_version_id), pinned_field_ids (the sorted list of
field IDs in the new version's schema_json — needed by the JS grid
so the per-row out-of-schema mask refreshes after reassignment without
a full page reload), the per-row output-language hints
(output_language / output_language_label /
output_language_is_rtl), and source_languages /
source_language_labels from the new version's pinned schema.
The output-language hints are read by batch_grid.js::reassignDocVersion
to refresh row.output_language* after a reassignment — without
them, a doc reassigned from a French-only version to an Arabic version
would still render its cells LTR (the per-row RTL flag would stay
stale until a full page reload), and the inline editor + sub-table
modal would inherit the wrong language label too.
AD-205 clean cut: this serializer no longer reads or emits
translation_language. Stored schema_json blobs were rewritten
by backfill_schema_keys before deploy, so every read site can
safely assume output_language is the only key.
curl --request POST \
--url https://api.example.com/api/v2/batches/{batch_id}/documents/{doc_id}/version/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version_number": 2
}
'import requests
url = "https://api.example.com/api/v2/batches/{batch_id}/documents/{doc_id}/version/"
payload = { "version_number": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({version_number: 2})
};
fetch('https://api.example.com/api/v2/batches/{batch_id}/documents/{doc_id}/version/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 123,
"version_number": 1073741823,
"published_at": "2023-11-07T05:31:56Z",
"published_by": {
"id": 123,
"email": "jsmith@example.com"
},
"field_count": 123,
"is_deprecated": true,
"deprecated_by": {
"id": 123,
"email": "jsmith@example.com"
},
"pinned_field_ids": [
"<string>"
],
"output_language": "<string>",
"output_language_label": "<string>",
"output_language_is_rtl": true,
"source_languages": [
"<string>"
],
"source_language_labels": [
"<string>"
],
"publish_note": "<string>",
"deprecated_at": "2023-11-07T05:31:56Z",
"deprecation_note": "<string>"
}{}{}{}
