Connect a service to a project

Grants a connected service, such as Pod CI once GitHub is connected to the project, a key for this one project.

POST/v1/service-grants

Grants a connected service, such as Pod CI once GitHub is connected to the project, a key for this one project. The key is of class service_grant, holds only the scopes the service needs (Pod's list of connected services, not the caller's choice) and carries the service's billing mark: sandboxes it creates are billed through that service's own usage events, never at sandbox rates. Only an owner of the organization, signed in with a fresh second factor, can grant; an API key answers person_required. A project holds one grant per service and mode that is not revoked; another answers conflict. The key's secret goes to the service, never to the owner (handover: service): Pod encrypts it to the service's own public key, keeps only that encrypted copy and the secret's SHA-256 hash, and answers secret: null. The service collects the encrypted copy over its own authenticated channel to Pod, opens it with its private key and acknowledges it, and Pod then forgets the copy; neither the browser, an operator nor Pod can read the secret. A copy the service has not collected within 7 days is forgotten, and so is the copy of a revoked grant: grant again. In a development cell with no key configured for the service, the secret is shown this once instead (handover: shown_once); staging and production never do that and answer unavailable until the service's key is set. A repeat with the same Idempotency-Key answers conflict and never the secret again.

For people only: a signed-in person with a fresh second factor makes this call, from the dashboard. Any API key is refused with person_required.

Request

curl -X POST "https://api.pod.mapier.ai/v1/service-grants" \
  -H "Authorization: Bearer $POD_PERSON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"project":"prj_3ahrz6dmv29gqy5ckt18fp","service":"pod-ci"}'

Parameters

NameInTypeRequiredWhat it is
Idempotency-KeyheaderstringNoMakes a repeat of this call safe for 24 hours.

Body

FieldTypeRequiredWhat it is
projectstringYes
service"pod-ci"YesA service a project can be connected to. Its grant's billing mark has the same name.
mode"test" | "live"NoThe grant key's mode; live when left out.

Answer

201. The grant and its key; the secret went to the service (handover).

201
{
  "grant": {
    "id": "sgr_3ahrz6dmv29gqy5ckt18fp",
    "project": "prj_3ahrz6dmv29gqy5ckt18fp",
    "service": "pod-ci",
    "mode": "test",
    "key": "key_3ahrz6dmv29gqy5ckt18fp",
    "billing_mark": "example",
    "scopes": ["sandboxes:read"],
    "granted_by": "example",
    "created_at": "2026-11-23T12:00:00.000Z",
    "revoked_at": null
  },
  "key": {
    "id": "key_3ahrz6dmv29gqy5ckt18fp",
    "name": "example",
    "project": "prj_3ahrz6dmv29gqy5ckt18fp",
    "mode": "test",
    "class": "person",
    "scopes": ["sandboxes:read"],
    "last_four": "example",
    "created_by": "example",
    "created_at": "2026-11-23T12:00:00.000Z",
    "expires_at": null,
    "revoked_at": null,
    "service": null,
    "billing_mark": null,
    "parent_sandbox": null,
    "parent_scopes": null,
    "last_used_at": null,
    "rotated_at": null,
    "previous_secret_until": null
  },
  "secret": null,
  "handover": "service"
}
FieldTypeAlwaysWhat it is
grantServiceGrantYesA connected service's key for one project.
keyApiKeyYes
secretstring | nullYesnull when the secret was encrypted for the service (handover: service); shown once only with handover: shown_once, in a development cell.
handover"service" | "shown_once"YesHow the grant's secret reached its service. service: encrypted to the service's own public key and collected by the service, so no person sees it. shown_once: answered once in secret, only in a development cell with no key configured for the service.

Errors

The refusals this call is known for: invalid, person_required, forbidden, conflict, unavailable, quota_exceeded. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.

In the SDKs

ClientCall
TypeScriptpod.serviceGrants.create({ … })
Pythonpod.service_grants.create(…)