Skip to main content

Spec Drafts

Read a Spec draft with its revision, replace it safely under an optimistic lock, and check any Spec document for errors and warnings before you save or publish it.

A Spec has one draft and any number of published versions. You edit the draft; runs use the published version. Each save bumps the draft revision. Send the revision you read with every edit: if someone saved in between you get a 409 and nothing changes, so you never overwrite another editor's work.

GET/v1/specs/{id}/draft
PUT/v1/specs/{id}/draft

Body

doc*objectThe complete document.
revision*integerThe revision you read. A mismatch is a 409.
allow_field_resetbooleanConfirm an edit that replaces most fields with new ones (422 otherwise).
Keep each field's field_id when you rename or retype it. Ground truth, rules and other references point at the id, not the name; new ids lose them.
POST/v1/specs/{id}/check

Response fields

validbooleanFalse when there is at least one error. A draft with errors cannot be published.
errors[]objectcode, message, and where: path, field_id, stage_id.
warnings[]objectSame shape; warnings do not block a publish.

Check response

{
  "spec_id": "e2144027-39c0-44e8-a196-72be1e360749",
  "valid": false,
  "errors": [
    { "severity": "error", "code": "SPEC2_DUPLICATE_FIELD_NAME", "message": "Two fields are named total_amount.",
      "path": "fields[3].name", "field_id": "f-total-2", "stage_id": null }
  ],
  "warnings": []
}

Frequently asked questions

Does check cost credits?+
No. It reads and computes only; it never saves or runs anything.
What happens on a 409?+
Someone saved the draft after you read it. Read the draft again, re-apply your change to the new document, and send the new revision.