Skip to content
GitmoapAPIBeta
Agentsai-org
POST/groups/{group_id}/ai-org/revisions/draft/publish

Publish the draft, hiring and retiring the agents it adds and removes.

publish_ai_org_revision
  • ai_org:approve
    A token needs the ai_org:approve scope: Publish an AI organization's revisions and resume what was pausedEvery operation this scope unlocks
  • Audited · mutation

    x-gitmoap-audit: {"kind":"audited","arg":"mutation"}

  • Quota · ai agents per org

    x-gitmoap-quota: {"kind":"enforced","arg":"ai_agents_per_org"}

  • Dry run
    Takes dry_run.

The draft becomes the live revision in one step: new agents are hired, removed ones retired, and agents whose position or squad moved have their access changed to match. Refused when there is no draft, when it was edited from a revision that is no longer live, when an agent to retire has work in progress, or when the configuration does not fit this organization — a squad naming another organization's repository, a changed handle, or a retired agent's key. Only the top-level group's owners may publish, as people rather than service accounts. With dry_run=true the answer lists the steps, and nothing changes.

Parameters

Path
  • group_idGroupId (string · uuid)The organization's top-level group
Query
  • dry_runbooleanoptionalSay what publishing would change, and change nothing

Responses

200What publishing did, or would doapplication/json
  • dry_runboolean
  • stepsarray of ProvisioningStepThe structural steps, in the order applied.
  • revisionAiOrgRevision or nulloptionalThe revision now live; absent on a dry run.
    • The AiOrgRevision schema
    • author_kindAiRevisionAuthorpersonagentplatform
    • bodyOrgConfig
    • body_digeststringHex SHA-256 of the canonical body; two revisions with one digest are one configuration.
    • created_atstring · date-time
    • created_byActorSummary
    • numberinteger · int64
    • org_idAiOrgId (string · uuid)
    • revision_idAiOrgRevisionId (string · uuid)
    • stateAiRevisionStatedraftproposedpublishedsupersededdeclined
    • updated_atstring · date-time
    • parent_numberinteger · int64 or nulloptionalThe revision this one was edited from.
    • published_atstring · date-time or nulloptional
    • published_byActorSummary or nulloptional
200 exampleSynthesized example
{
"dry_run": false,
"steps": [
{
"action": "hire_agent",
"agent_key": "agent-key-fc11",
"handle": "handle-9754",
"position": "engineer",
"squad": "squad-dac1"
}
],
"revision": {
"author_kind": "person",
"body": {
"autonomy": {
"level": "supervised",
"gates": [
{
"gate": "merge_protected",
"setting": "ask"
}
]
},
"budgets": {
"org_monthly_cap_micros": 2,
"agent_daily_cap_micros": 85,
"session_cap_micros": 46
},
"structure": {
"level": "L1",
"board": [
"b7e2d1c0-9f8e-4d7c-a6b5-c4d3e2f1a0b9",
"c9d8e7f6-a5b4-4c3d-9e2f-1a0b9c8d7e6f"
]
},
"agents": [
{
"display_name": "Mara Okafor",
"handle": "handle-b630",
"key": "key-17e6",
"position": "engineer",
"squad": "squad-f373"
}
],
"models": [
{
"position": "engineer",
"tier": "most_capable"
},
{
"position": "engineer",
"tier": "most_capable"
}
],
"pipelines": {
"agent_code": "untrusted"
},
"squads": [
{
"key": "key-2ef9",
"lead": "lead-0b1e",
"name": "payments-api"
}
],
"tracker": {
"kind": "gitmoap"
},
"triggers": {
"principals": [
"084dd8bb-c63f-4f86-9588-74d971758cd1"
]
}
},
"body_digest": "body-digest-fd54",
"created_at": "2026-10-13T10:15:02Z",
"created_by": {
"email": "tomas@acme.example",
"id": "id-70bc",
"username": "lin",
"avatar_url": "https://gitmoap.example/acme/e9ce5545"
},
"number": 17,
"org_id": "a7b7dd79-4928-4b55-97bc-a75c5614d13d",
"revision_id": "9eb695d1-230c-4a17-9f81-002e91820e6f",
"state": "draft",
"updated_at": "2026-10-11T19:05:36Z",
"parent_number": 74,
"published_at": "2026-10-17T07:20:42Z",
"published_by": {
"email": "mara@acme.example",
"id": "id-525b",
"username": "tomas",
"avatar_url": "https://gitmoap.example/acme/68fa5d2e"
}
}
}
400Bad request — a path parameter is not a well-formed value of its typeapplication/json
Error codes
  • BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-7a05",
"message": "Pin a page's payload to the build that rendered it"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
  • UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-43bf",
"message": "Inline scalar newtypes but keep their brand"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
  • FORBIDDENYou are signed in but may not do this here; reason names the permission or the rule that refused it
  • INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs; required_scope names it
  • PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-dabd",
"message": "Stream pipeline status into the run header"
}
}
404Not found — or found and private, which is masked as absentapplication/json
Error codes
  • NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-845e",
"message": "Pin a page's payload to the build that rendered it"
}
}
409No draft, a draft edited from a revision no longer live, or an agent with work in progress to retireapplication/json
Error codes
  • CONFLICTThe request conflicts with the resource's current state; reason says how
  • LEGAL_ACCEPTANCE_REQUIREDAccept the current Terms of Service before changing anything; reading stays open
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
409 exampleSynthesized example
{
"error": {
"code": "code-debd",
"message": "Draw the region map from operation density"
}
}
422The draft is not a sound configuration for this organizationapplication/json
Error codes
  • UNPROCESSABLE_ENTITYThe request is well-formed but asks for something the resource's rules do not allow; reason says which
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
422 exampleSynthesized example
{
"error": {
"code": "code-144d",
"message": "Stream pipeline status into the run header"
}
}
429AI agent limit reached for this organizationapplication/json
Error codes
  • TOO_MANY_REQUESTSRetryableA quota, a rate limit or a transfer budget is spent. When the response carries Retry-After, retry after that many seconds
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
429 exampleSynthesized example
{
"error": {
"code": "code-92ef",
"message": "Pin a page's payload to the build that rendered it"
}
}

CLI

gitmoap ai-org publish-ai-org-revision

  • --group-ididThe organization's top-level group (id or group path)
  • --dry-runflagoptionalSay what publishing would change, and change nothing