# Create a commit status

> Set a status on a commit: state (pending, success, failure or error), context (what reports it, such as ci/build; default by default), description (at most 140 characters) and target_url (where to see more).

<div class="g1t-endpoint"><span class="g1t-method" data-method="post">POST</span><code>/repos/{owner}/{name}/statuses/{sha}</code></div>

A context has one status per commit: setting it again replaces it. A status is a check: a required check or a ruleset's required status check of its context is met by it. Needs the Write role; publishes status.created.

Setting a context again replaces its status on that commit. A status counts as a check: a required check named `ci/build`, in branch protection or a ruleset's `required_status_checks`, is met by it, and a ruleset check pinned to the `api` integration only by statuses and check runs reported through the API. See the [Checks guide](/guides/checks/).

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`workflow`](/reference/mcp/#workflow) with `action` `set_status`, and the same inputs
- **Scope:** An access token needs [`checks:write`](/guides/authentication/#scopes).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `owner` | string | Yes | The workspace that owns the repository. |
| `name` | string | Yes | The repository's name. |
| `sha` | string | Yes | The commit's full SHA. |

## Body parameters

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

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `state` | string | Yes | pending, success, failure or error. One of `pending`, `success`, `failure`, `error`. |
| `context` | string | No | What reports it, such as ci/build; default when left out. |
| `description` | string | No | A short word on it, at most 140 characters. |
| `target_url` | string | No | Where to see more, http or https. |

## Example request

```sh
curl -X POST https://api.g1t.sh/repos/flagon-io/hello/statuses/9f3c2a1b7e6d5c4b3a2918f7e6d5c4b3a2918f7e \
  -H "Authorization: Bearer $G1T_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "success",
    "context": "ci/build",
    "description": "Build #4821 passed",
    "target_url": "https://ci.example.com/builds/4821"
  }'
```

## Example response

A successful request answers `200` with:

```json
{
  "context": "ci/build",
  "state": "success",
  "description": "Build #4821 passed",
  "target_url": "https://ci.example.com/builds/4821",
  "updated_at": "2026-10-07T14:03:02.118Z",
  "source": "api"
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#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. |
