Update a schema draft
Patch the working draft of a schema.
curl --request PATCH \
--url https://api.example.com/api/v2/structs/{slug}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"schema_json": "<unknown>",
"annotations_json": "<unknown>",
"sample_attachment_id": 123,
"black_hole_enabled": true
}
'import requests
url = "https://api.example.com/api/v2/structs/{slug}/"
payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"schema_json": "<unknown>",
"annotations_json": "<unknown>",
"sample_attachment_id": 123,
"black_hole_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
description: '<string>',
schema_json: '<unknown>',
annotations_json: '<unknown>',
sample_attachment_id: 123,
black_hole_enabled: true
})
};
fetch('https://api.example.com/api/v2/structs/{slug}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 123,
"slug": "<string>",
"name": "<string>",
"field_count": 123,
"has_unpublished_changes": true,
"current_version_number": 123,
"version_count": 123,
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"schema_json": "<unknown>",
"annotations_json": "<unknown>",
"sample_attachment": {},
"current_version": {
"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"
},
"publish_note": "<string>",
"deprecated_at": "2023-11-07T05:31:56Z",
"deprecation_note": "<string>"
},
"parsed_sections": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"status": "draft",
"mode": "form",
"black_hole_enabled": true,
"latest_proposals_json": null
}{}{}Authorizations
Body
Write shape for POST /structs/ and PATCH /structs/{slug}/.
Accepts only the editable fields. Validates schema_json against the
ExtractionSchema Pydantic model so malformed schemas are rejected up
front. Status is read-only at this layer — transitions go through the
publish / archive (delete) endpoints.
Org-scoped black-hole participation flag (Decision 2). Only the current PUBLISHED, non-deprecated version participates in classification — enforced by documents.services.black_hole.black_hole_participants(), not here. The flag may be set on a draft; it becomes effective on first publish.
Response
Full Struct projection for the detail / restore response.
Adds the working draft body (schema_json, annotations_json), the
nested current version summary, optional sample attachment, and a
description for editing.
Org-scoped black-hole participation flag (Decision 2). Only the current PUBLISHED, non-deprecated version participates in classification — enforced by documents.services.black_hole.black_hole_participants(), not here. The flag may be set on a draft; it becomes effective on first publish.
curl --request PATCH \
--url https://api.example.com/api/v2/structs/{slug}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"schema_json": "<unknown>",
"annotations_json": "<unknown>",
"sample_attachment_id": 123,
"black_hole_enabled": true
}
'import requests
url = "https://api.example.com/api/v2/structs/{slug}/"
payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"schema_json": "<unknown>",
"annotations_json": "<unknown>",
"sample_attachment_id": 123,
"black_hole_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
slug: '<string>',
description: '<string>',
schema_json: '<unknown>',
annotations_json: '<unknown>',
sample_attachment_id: 123,
black_hole_enabled: true
})
};
fetch('https://api.example.com/api/v2/structs/{slug}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 123,
"slug": "<string>",
"name": "<string>",
"field_count": 123,
"has_unpublished_changes": true,
"current_version_number": 123,
"version_count": 123,
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"schema_json": "<unknown>",
"annotations_json": "<unknown>",
"sample_attachment": {},
"current_version": {
"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"
},
"publish_note": "<string>",
"deprecated_at": "2023-11-07T05:31:56Z",
"deprecation_note": "<string>"
},
"parsed_sections": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"status": "draft",
"mode": "form",
"black_hole_enabled": true,
"latest_proposals_json": null
}{}{}
