Skip to content
GitmoapAPIBeta
Agentsai-org
POST/groups/{group_id}/ai-org/profile-drafts

Draft an agent's persona from a brief. The draft is written in a minute or two.

create_ai_profile_draft
  • ai_org:manage
    A token needs the ai_org:manage scope: Configure and operate an AI organization: drafts, pausing, suspending, sessionsGranted by write_api.Every operation this scope unlocks
  • Audited · mutation

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

  • Quota · ai profile drafts per person per day

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

A small model works out what the agent's job involves, reads a little of the organization's repositories to learn how the team works, and writes a persona you can edit into the agent's profile in the revision draft — it is never applied for you. It reads only repositories you and everyone who can see the organization can read. Follow it on its watch stream, or read it again until it is ready or failed. You may start five in any 24 hours; the organization fifty a day, two at a time. Maintainers and above of the organization's top-level group may draft one.

Parameters

Path
  • group_idGroupId (string · uuid)The organization's top-level group

Request body

application/json
  • briefProfileDraftBrief (string)What the agent is for, in your words.
  • model_idAiModelKey (string) or nulloptionalThe model to draft with: any active model served in the organization's region, as the model catalogue lists them. Leave it out and the economical tier's default model is used.
  • positionPositionengineerreviewerproduct_ownerdirectorrelease_managertechnical_writeror nulloptionalThe position to write the persona for. Leave it out and the drafter chooses one and says which.
  • repository_idsarray of RepositoryId (string · uuid) or nulloptionalUp to five repositories of the organization to ground the persona in. Leave it out and the five pushed to most recently are used, among those everyone who can see the organization can read.
Request body exampleSynthesized example
{
"brief": "brief-d769"
}

Responses

202The draft, queued; its address is in `Location`application/json
  • briefProfileDraftBrief (string)What was asked for.
  • cost_microsinteger · int64What it cost, fee included, in micro-dollars.
  • created_atstring · date-timeWhen it was asked for.
  • draft_idAiProfileDraftId (string · uuid)The draft.
  • org_idAiOrgId (string · uuid)The organization it was written for.
  • repositoriesarray of ProfileDraftRepositoryThe repositories it reads.
  • stateAiProfileDraftStatequeuedrunningreadyfailedWhere it stands.
  • completed_atstring · date-time or nulloptionalWhen it was finished.
  • failureAiProfileDraftFailurebudget_exhaustedrefusedaccess_changedtimed_outcancellederroror nulloptionalWhy it was not written, when it failed.
  • model_idAiModelKey (string) or nulloptionalThe model it is written with: the one asked for, else the economical tier's default once the draft starts.
  • personaAgentPersona (string) or nulloptionalThe persona, once it is written: put it in the agent's profile.persona in the revision draft, edited as you see fit.
  • positionPositionengineerreviewerproduct_ownerdirectorrelease_managertechnical_writeror nulloptionalThe position that was asked for, when one was.
  • sourcesarray of ProfileDraftSourceoptionalThe files the persona drew on.
    • The ProfileDraftSource schema
    • pathFilePath (string)The file's path on the repository's default branch.
    • repository_idRepositoryId (string · uuid)The repository the file is in.
  • summaryProfileDraftSummary (string) or nulloptionalWhat the drafted agent does, in one line, once it is written.
  • written_forPositionengineerreviewerproduct_ownerdirectorrelease_managertechnical_writeror nulloptionalThe position the persona is written for, once it is written.
202 exampleSynthesized example
{
"brief": "brief-5635",
"cost_micros": 1,
"created_at": "2026-10-12T03:26:26Z",
"draft_id": "d576da3a-ee1d-4a4f-8052-48466cfa99c4",
"org_id": "d5c2d996-621b-4593-b003-3a54af938b18",
"repositories": [
{
"full_path": "acme/payments-api",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70"
},
{
"full_path": "acme/payments-api",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70"
}
],
"state": "queued",
"completed_at": "2026-10-10T16:46:33Z",
"failure": "budget_exhausted",
"model_id": "ea26e358-9011-4312-8637-2c58518aa577",
"persona": "persona-83d8",
"position": "engineer",
"sources": [
{
"path": "path-3735",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70"
},
{
"path": "path-45be",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70"
}
],
"summary": "summary-ae8f",
"written_for": "engineer"
}
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-ac1f",
"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-1d8b",
"message": "Label every synthesized example"
}
}
402The organization's balance cannot cover a draftapplication/json
Error codes
  • 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.
402 exampleSynthesized example
{
"error": {
"code": "code-bc8b",
"message": "Label every synthesized example"
}
}
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-64c3",
"message": "Draw the region map from operation density"
}
}
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-9cd6",
"message": "Stream pipeline status into the run header"
}
}
409Consent is not recorded, or the organization is paused or retiredapplication/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-9e69",
"message": "Stream pipeline status into the run header"
}
}
422A repository cannot ground a persona; the message names it and whyapplication/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-c8f7",
"message": "Label every synthesized example"
}
}
429A limit on drafts is reached; `Retry-After` says when it frees upapplication/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-c298",
"message": "Pin a page's payload to the build that rendered it"
}
}

CLI

gitmoap ai-org create-ai-profile-draft

  • --group-ididThe organization's top-level group (id or group path)
  • --briefstringWhat the agent is for, in your words.
  • --model-idstringoptional
  • --positionengineer | reviewer | product_owner | director | release_manager | technical_writeroptional
  • --repository-idsjsonoptionalUp to five repositories of the organization to ground the persona in. Leave it out and the five pushed to most recently are used, among those everyone who can see the organization can read.