Skip to content

Put an agent on something in one step: open an issue and assign it to the g1t agent at once.

POST/repos/{owner}/{name}/issues/delegate

Say what you want done in plain words; give checks, commands that must pass, when you know them. Needs the Write role or higher, and nothing is opened without it. The issue is opened whatever happens next: agent.status is started (pull is the draft pull request the agent opened; follow it with get_pull_request), queued (every agent slot of the workspace is busy; it starts by itself when one frees up) or not_started, with agent.code saying why (not_paid, trial_used, limit, paused, issue_cap, billing_unavailable or no_model), agent.message saying what to do, and agent.fix_url where. There is no model or agent count to choose.

The issue is opened whatever becomes of the agent. When the workspace’s plan does not let it start, pull is null and agent says why and where to fix it, for example { "status": "not_started", "code": "not_paid", "message": "Agents need a paid workspace. Start the $20 plan or try it with $5 of free usage after a card check: /acme/-/billing", "fix_url": "https://g1t.sh/acme/-/billing" }. With every agent slot busy, status is queued and it starts by itself when one frees up. See putting an agent on something.

  • Authentication: Required. Send an access token as Authorization: Bearer.
  • MCP tool: agent with action delegate, and the same inputs
  • Scope: An access token needs agents:run.
Name Type Required Description
owner string Yes The workspace that owns the repository.
name string Yes The repository’s name.

Send a JSON object. Names are snake_case, as in responses; the camelCase spelling is accepted too.

Name Type Required Description
title string Yes What should be true when it is done, in one line.
body string No Markdown. What you want done, in plain words: what is wrong or wanted, and anything the agent cannot see for itself.
checks array of strings No Commands that must pass for its pull request to be accepted, e.g. “npm test”.
labels array of strings No What kind of issue this is, e.g. “bug”.
curl -X POST https://api.g1t.sh/repos/flagon-io/hello/issues/delegate \
-H "Authorization: Bearer $G1T_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Retry webhooks with exponential backoff",
"body": "Deliveries that fail are dropped today. Retry them with exponential backoff, up to six times, then mark the delivery failed.",
"checks": [
"npm test"
]
}'

A successful request answers 200 with:

{
"issue": {
"id": "iss_01m4a2c8v1t7k3q9x5n0r2w6yd",
"repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
"number": 41,
"title": "Retry webhooks with exponential backoff",
"body": "Deliveries that fail are dropped today. Retry them with exponential backoff, up to six times, then mark the delivery failed.",
"labels": [],
"checks": [
"npm test"
],
"state": "open",
"reason": null,
"resolved_by": null,
"author": {
"id": "usr_01kkntcg1eeb98j62xjm7eh09p",
"username": "syntaqx",
"kind": "user",
"verified": false,
"workspaces": []
},
"created_at": "2026-10-05T14:02:11.204Z",
"updated_at": "2026-10-05T14:02:11.204Z",
"closed_at": null,
"pull_count": 1,
"comment_count": 0,
"assignees": [],
"blocked_by": [],
"queued": false,
"agent": "g1t-agent"
},
"pull": {
"id": "pr_01m4a2c9b6e0h4m8q2t6x0a4d8",
"repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
"number": 42,
"issue": 41,
"title": "Retry webhooks with exponential backoff",
"body": null,
"agent": "g1t-agent",
"runtime": "hosted",
"status": "draft",
"fork": {
"namespace": "pulls",
"name": "pr_01m4a2c9b6e0h4m8q2t6x0a4d8"
},
"fork_repo_id": "rep_01m4a2c9d2g6k0n4r8v2z6c0f4",
"branch": null,
"head_commit": null,
"merge_base": null,
"merged_by": null,
"merged_at": null,
"superseded_by": null,
"check_status": null,
"files": [],
"assignees": [],
"reviewers": [],
"author": {
"id": "usr_01kkntcg1eeb98j62xjm7eh09p",
"username": "syntaqx",
"kind": "user",
"verified": false,
"workspaces": []
},
"created_at": "2026-10-05T14:02:12.880Z",
"updated_at": "2026-10-05T14:02:12.880Z",
"confidence": null
},
"agent": {
"status": "started",
"code": null,
"message": null,
"fix_url": null
}
}

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository.
404 not_found It does not exist, or you cannot see it.
409 conflict The request conflicts with the current state.
422 invalid The input is not valid. message says which field and why.