Code graph API
This page documents the 15 gateway endpoints tagged code graph in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| GET | /code_graph/credentials | List the credentials bound for code indexing |
| POST | /code_graph/credentials/bind | Allow one tenant to index with a stored credential |
| POST | /code_graph/repos/connect | Connect a repository for indexing |
| GET | /code_graph/repos | List the connected repositories |
| GET | /code_graph/repos/{repo_id}/runs | List the index runs of a repository |
| POST | /code_graph/repos/{repo_id}/reindex | Index a repository again |
| POST | /code_graph/repos/{repo_id}/settings | Turn permission mirroring on or off for a repository |
| POST | /code_graph/repos/{repo_id}/webhook | Rotate the webhook of a repository |
| POST | /code_graph/repos/{repo_id}/delete | Disconnect a repository and delete its index |
| GET | /code_graph/app | Show the code graph GitHub App status |
| POST | /code_graph/app/install | Start a code graph GitHub App install |
| POST | /code_graph/app/install/complete | Finish a code graph GitHub App install |
| POST | /code_graph/webhooks/app | Receive a code graph GitHub App webhook |
| POST | /code_graph/webhooks/repo/{webhook_id} | Receive a code graph GitHub repository webhook |
| POST | /code_graph/webhooks/gitlab/{webhook_id} | Receive a code graph GitLab project webhook |
Endpoints
GET /code_graph/credentials
List the credentials bound for code indexing
List the stored source control credentials bound to a tenant for indexing, so you know which
credential_name a repository connection can use. Secrets are never returned. A proxy admin, an admin viewer,
a user whose role grants a code graph permission, or a team admin who passes team_id may call it. Nothing is
changed
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | string or null | No | |
team_id | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/code_graph/credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphCredentialList |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
credentials | array of CodeGraphCredential | Yes | Credentials |
POST /code_graph/credentials/bind
Allow one tenant to index with a stored credential
Bind a stored GitHub personal access token or GitLab access token credential to the one tenant allowed to
index repositories with it. Without tenant_id it is bound to the caller's own organization, or default for
callers without one. A proxy admin or a user whose role grants code_graph.manage may call it, team admins
may not. The binding is written to the audit log
Request body (application/json, schema CodeGraphCredentialBindRequest):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
credential_name | string | Yes | Credential Name |
Example request:
curl -X POST "http://localhost:4000/code_graph/credentials/bind" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "default",
"credential_name": "repo-indexer"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphCredentialBound |
| 400 | The named credential is not a stored source control token | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
credential_name | string | Yes | Credential Name |
POST /code_graph/repos/connect
Connect a repository for indexing
Connect a GitHub repository or GitLab project for indexing. A team admin can connect a repository their team
will own. The connecting user and the tenant's bound credential must both be able to read it upstream, and for
GitLab the user must be an active member of the project with at least the Reporter role. The first index run
is queued at once, and the webhook secret in the answer is shown only this one time. A proxy admin, a user
whose role grants code_graph.manage, or a team admin for their own team may call it. The connection is written
to the audit log
Request body (application/json, schema CodeGraphConnectRequest):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
team_id | string or null | No | Team Id |
provider | enum: "jira", "gitlab" | No | Provider |
full_name | string | Yes | Full Name |
external_repo_id | string | Yes | External Repo Id |
default_branch | string | Yes | Default Branch |
credential_name | string | Yes | Credential Name |
owner_team_id | string or null | No | Owner Team Id |
user_token_server_id | string | Yes | User Token Server Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/repos/connect" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"full_name": "examplecorp/payments",
"external_repo_id": "123456789",
"default_branch": "main",
"credential_name": "repo-indexer",
"owner_team_id": "payments-team",
"user_token_server_id": "source-mcp"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphRepoConnected |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 409 | The repository is already connected in this tenant | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
repo | CodeGraphRepo | Yes | |
run_id | string | Yes | Run Id |
webhook | CodeGraphWebhook or null | Yes |
GET /code_graph/repos
List the connected repositories
List the repositories connected in a tenant with their index status, or the ones a team owns when a team
admin asks with team_id. A proxy admin, an admin viewer, a user whose role grants a code graph permission, or
a team admin may call it. Nothing is changed
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | string or null | No | |
team_id | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/code_graph/repos" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphRepoList |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
repos | array of CodeGraphRepo | Yes | Repos |
GET /code_graph/repos/{repo_id}/runs
List the index runs of a repository
List the latest index runs of one repository, newest first, with how many files each one read and changed and the error of a failed run. A proxy admin, an admin viewer, a user whose role grants a code graph permission, or the admin of the team that owns the repository may call it. Nothing is changed
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
repo_id | path | string | Yes | |
tenant_id | query | string or null | No | |
team_id | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/code_graph/repos/repo_id-123/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphRunList |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 404 | No connected repository has that id in the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
runs | array of CodeGraphRun | Yes | Runs |
POST /code_graph/repos/{repo_id}/reindex
Index a repository again
Queue an index run for a connected repository. A run already waiting is started now instead. A proxy admin,
a user whose role grants code_graph.reindex or code_graph.manage, or the admin of the owning team may call
it. The request is written to the audit log
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
repo_id | path | string | Yes |
Request body (application/json, schema CodeGraphRepoAction):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
team_id | string or null | No | Team Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/repos/repo_id-123/reindex" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "payments-team"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphRunQueued |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 404 | No connected repository has that id in the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
repo_id | string | Yes | Repo Id |
run_id | string | Yes | Run Id |
POST /code_graph/repos/{repo_id}/settings
Turn permission mirroring on or off for a repository
Turn upstream permission mirroring on or off. With it on, a caller only sees the repository while their own
GitHub or GitLab identity, from the per-user OAuth token of the named MCP server, can read it. With it off,
anyone granted the repository through a team or key sees it. A proxy admin, a user whose role grants
code_graph.manage, or the admin of the owning team may call it. The change is written to the audit log with
the previous and the new setting
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
repo_id | path | string | Yes |
Request body (application/json, schema CodeGraphRepoSettings):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
team_id | string or null | No | Team Id |
mirror_source_permissions | boolean | Yes | Mirror Source Permissions |
acl_server_id | string or null | No | Acl Server Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/repos/repo_id-123/settings" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mirror_source_permissions": true,
"acl_server_id": "repo-acl-mcp"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphRepo |
| 400 | Mirroring was turned on without the MCP server to check access with | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 404 | No connected repository has that id in the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
repo_id | string | Yes | Repo Id |
tenant_id | string | Yes | Tenant Id |
provider | string | Yes | Provider |
full_name | string | Yes | Full Name |
default_branch | string | Yes | Default Branch |
owner_team_id | string or null | Yes | Owner Team Id |
status | string | Yes | Status |
last_indexed_sha | string or null | Yes | Last Indexed Sha |
last_error | string or null | Yes | Last Error |
webhook_path | string or null | Yes | Webhook Path |
mirror_source_permissions | boolean | Yes | Mirror Source Permissions |
acl_server_id | string or null | Yes | Acl Server Id |
last_event_at | string or null | Yes | Last Event At |
POST /code_graph/repos/{repo_id}/webhook
Rotate the webhook of a repository
Give the repository a new webhook path and secret. The old ones stop working, and the secret is only shown
in this response, so update the webhook at the source control host right away. A proxy admin, a user whose role
grants code_graph.manage, or the admin of the owning team may call it. The rotation is written to the audit
log
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
repo_id | path | string | Yes |
Request body (application/json, schema CodeGraphRepoAction):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
team_id | string or null | No | Team Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/repos/repo_id-123/webhook" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "payments-team"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphWebhook |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 404 | No connected repository has that id in the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph is not configured, or no salt key is set to sign webhooks | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path |
secret | string | Yes | Secret |
POST /code_graph/repos/{repo_id}/delete
Disconnect a repository and delete its index
Disconnect a repository and delete everything indexed from it. This cannot be undone, connect the repository
again to rebuild the index. A proxy admin, a user whose role grants code_graph.manage, or the admin of the
owning team may call it. The deletion is written to the audit log
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
repo_id | path | string | Yes |
Request body (application/json, schema CodeGraphRepoAction):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
team_id | string or null | No | Team Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/repos/repo_id-123/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"team_id": "payments-team"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json CodeGraphRepoDeleted |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 404 | No connected repository has that id in the caller's scope | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
repo_id | string | Yes | Repo Id |
deleted | boolean | Yes | Deleted |
GET /code_graph/app
Show the code graph GitHub App status
Shows whether a GitHub App is set up for the code graph, the gateway path that receives its webhooks, and which actions the caller may take: connect repositories, queue index runs, install the App and bind credentials. The Admin UI reads it to decide which buttons to show. Any caller with read access to the tenant or team may call it. Nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | string or null | No | |
team_id | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/code_graph/app" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whether the App is set up and what the caller may do with it | application/json CodeGraphApp |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
configured | boolean | Yes | Configured |
slug | string or null | Yes | Slug |
webhook_path | string | Yes | Webhook Path |
can_manage | boolean | Yes | Can Manage |
can_reindex | boolean | Yes | Can Reindex |
can_install | boolean | Yes | Can Install |
can_bind_credentials | boolean | Yes | Can Bind Credentials |
POST /code_graph/app/install
Start a code graph GitHub App install
Starts installing the code graph GitHub App for a tenant. Returns the upstream service link to open; the upstream service sends the user back to the Admin UI with a sealed state that only the same user can complete within ten minutes. Only a signed-in user who manages the whole tenant may call it (team admins cannot). Nothing is stored yet.
Request body (application/json, schema CodeGraphInstallStart):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string or null | No | Tenant Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/app/install" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "tenant-acme"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The link to open on the upstream service and how long it stays valid | application/json CodeGraphInstallLink |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller cannot manage the whole tenant or is not a signed-in user | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | No GitHub App is configured, or install links cannot be sealed on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
install_url | string | Yes | Install Url |
expires_in_seconds | integer | Yes | Expires In Seconds |
POST /code_graph/app/install/complete
Finish a code graph GitHub App install
Finishes a code graph GitHub App install that the same user started. The installation is bound to the tenant only when the upstream service confirms, with the user's own sign-in code, that this user can see it, so nobody can claim another organization's installation. Only a signed-in user who manages the whole tenant may call it. On success the installation becomes a credential the tenant's repositories can use, and an audit row is written.
Request body (application/json, schema CodeGraphInstallComplete):
| Field | Type | Required | Description |
|---|---|---|---|
state | string | Yes | State |
installation_id | string | Yes | Installation Id |
code | string | Yes | Code |
Example request:
curl -X POST "http://localhost:4000/code_graph/app/install/complete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state": "eyJ...",
"installation_id": "12345678",
"code": "example-oauth-code"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The installation is now bound to the tenant | application/json CodeGraphInstallationBound |
| 400 | The install link expired, could not be read or was started by someone else | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller cannot manage the tenant, or the upstream service did not confirm the user can see the installation | application/json ErrorDetail |
| 409 | The installation already belongs to another tenant | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 502 | The upstream service did not answer the installation lookup | application/json ErrorDetail |
| 503 | No GitHub App is configured, or install links cannot be sealed on this gateway | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | Tenant Id |
installation_id | string | Yes | Installation Id |
credential_name | string | Yes | Credential Name |
POST /code_graph/webhooks/app
Receive a code graph GitHub App webhook
Keeps the code graph up to date when code changes. The upstream service calls this, not people: point the GitHub App's
webhook URL here. No gateway key is needed, instead the body must be signed with the App's webhook secret in the
X-Hub-Signature-256 header, and X-GitHub-Delivery must carry the delivery id.
A push to a connected repository's default branch queues one index run (several quick pushes share one run). A
removed installation or repository makes the affected repositories unreadable until access comes back, and an
audit row records it under the system:code_graph actor. A delivery the upstream service sends twice is answered duplicate
and changes nothing. The answer is always 202 with the outcome, a bad signature answers 401 and an unreadable
payload 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-GitHub-Delivery | header | string | Yes | |
X-Hub-Signature-256 | header | string or null | No | |
X-GitHub-Event | header | string or null | No |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/code_graph/webhooks/app" \
-H "Content-Type: application/json" \
-d '{
"ref": "refs/heads/main",
"after": "0000000000000000000000000000000000000001",
"repository": {
"id": 123456
},
"installation": {
"id": 7654321
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | Successful Response | application/json CodeGraphWebhookReceipt |
| 400 | The payload or its delivery id could not be read | application/json ErrorDetail |
| 401 | The X-Hub-Signature-256 header does not match the App's webhook secret | application/json ErrorDetail |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 413 | The body is larger than 5 MB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
POST /code_graph/webhooks/repo/{webhook_id}
Receive a code graph GitHub repository webhook
Keeps the code graph up to date for a repository connected with a personal access token. The upstream service calls this:
the repository's webhook points at this URL, including the webhook_id shown when the repository was
connected. No gateway key is needed, instead the body must be signed in X-Hub-Signature-256 with the secret
shown when the repository was connected or its webhook rotated.
A push to the default branch queues one index run (several quick pushes share one run), any other event is
answered ignored, and a repeated delivery duplicate. A bad signature answers 401 and an unreadable payload
400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
webhook_id | path | string | Yes | |
X-GitHub-Delivery | header | string | Yes | |
X-Hub-Signature-256 | header | string or null | No | |
X-GitHub-Event | header | string or null | No |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/code_graph/webhooks/repo/webhook_id-123" \
-H "Content-Type: application/json" \
-d '{
"ref": "refs/heads/main",
"after": "0000000000000000000000000000000000000001",
"repository": {
"id": 123456
},
"installation": {
"id": 7654321
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | Successful Response | application/json CodeGraphWebhookReceipt |
| 400 | The payload or its delivery id could not be read | application/json ErrorDetail |
| 401 | The X-Hub-Signature-256 header does not match this webhook's secret | application/json ErrorDetail |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 413 | The body is larger than 5 MB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |
POST /code_graph/webhooks/gitlab/{webhook_id}
Receive a code graph GitLab project webhook
Keeps the code graph up to date for a connected GitLab project. GitLab calls this: the project's webhook
points at this URL, including the webhook_id shown when the project was connected. No gateway key is needed,
instead the X-Gitlab-Token header must equal the secret token shown when the project was connected or its
webhook rotated, and Idempotency-Key or X-Gitlab-Event-UUID must carry the delivery id.
A push to the default branch queues one index run (several quick pushes share one run), any other event is
answered ignored, and a repeated delivery duplicate. A wrong token answers 401, and a missing delivery id or
an unreadable payload 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
webhook_id | path | string | Yes | |
X-Gitlab-Token | header | string or null | No | |
X-Gitlab-Event | header | string or null | No | |
X-Gitlab-Event-UUID | header | string or null | No | |
Idempotency-Key | header | string or null | No |
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
object_kind | "push" | Yes | Object Kind |
ref | string | Yes | Ref |
after | string | Yes | After |
project_id | integer | Yes | Project Id |
Example request:
curl -X POST "http://localhost:4000/code_graph/webhooks/gitlab/webhook_id-123" \
-H "Content-Type: application/json" \
-d '{
"object_kind": "push",
"ref": "refs/heads/main",
"after": "0000000000000000000000000000000000000001",
"project_id": 42
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | Successful Response | application/json CodeGraphWebhookReceipt |
| 400 | The payload or its delivery id could not be read | application/json ErrorDetail |
| 401 | The X-Gitlab-Token header does not match this webhook's secret token | application/json ErrorDetail |
| 403 | The license does not include the code graph, or the caller's role or team does not allow this | application/json ErrorDetail |
| 413 | The body is larger than 5 MB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | The code graph database is not set up on this gateway | application/json ErrorDetail |