Accounts and workspaces
Extend API key
Set a later expiry (expires_at) on an API key identified by id: at most 365 days from now, or 30 for a key an agent created. An agent can extend only keys its own grant created. Needs the Manage API keys grant.
POST /identity-api/api-keys/extendContract reviewed: · sha256:563d2d581da0ad29
Overview
Set a later expiry (expires_at) on an API key identified by id: at most 365 days from now, or 30 for a key an agent created. An agent can extend only keys its own grant created. Needs the Manage API keys grant.
The response includes the applied expiry. Requests beyond the lifetime cap return API_KEY_LIFETIME_EXCEEDS_CAP.
A successful HTTP response can mean that a request was accepted rather than completed. For background work, save the returned ID and check the same operation until it finishes. A scheduled or accepted post is published only when the platform confirms it; a client timeout does not establish the result.
Authentication and permissions
A token can use only the rights held by its owner. Each request checks workspace membership, resource ownership, selected workspaces and granted capabilities. Core and full profiles change which tools are displayed; they do not grant access.
Request fields
Required means required inside its parent object and selected branch. A required child does not make an optional parent required. Rules and field names below are copied from the contract.
| Field / branch | Type / required | Constraints |
|---|---|---|
$ | objectRequired in parent |
|
id | stringRequired in parent |
|
expires_at | stringRequired in parent | Requested new absolute expiry. The longest lifetime is 365 days from now, or 30 days for a key created by a delegated agent. A signed-in person extending their own key is granted that longest lifetime when they ask for a later time (up to 3,650 days from now); in every other case a later time is refused with API_KEY_LIFETIME_EXCEEDS_CAP. The response carries the expiry actually applied.
|
Complete JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"expires_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
"description": "Requested new absolute expiry. The longest lifetime is 365 days from now, or 30 days for a key created by a delegated agent. A signed-in person extending their own key is granted that longest lifetime when they ask for a later time (up to 3,650 days from now); in every other case a later time is refused with API_KEY_LIFETIME_EXCEEDS_CAP. The response carries the expiry actually applied."
}
},
"required": [
"id",
"expires_at"
],
"additionalProperties": false
}Response and completion
Success HTTP statuses: 200. When the operation is complete: synchronous_http_response.
A successful HTTP response can mean that a request was accepted rather than completed. For background work, save the returned ID and check the same operation until it finishes. A scheduled or accepted post is published only when the platform confirms it; a client timeout does not establish the result.
Required means required inside its parent object and selected branch. A required child does not make an optional parent required. Rules and field names below are copied from the contract.
| Field / branch | Type / required | Constraints |
|---|---|---|
$ | objectRequired in parent | — |
apiKey | objectRequired in parent | — |
apiKey.id | stringRequired in parent |
|
apiKey.name | stringRequired in parent | — |
apiKey.last_4 | stringRequired in parent | — |
apiKey.scopes | arrayRequired in parent | — |
apiKey.scopes[] | stringOptional / item | — |
apiKey.created_at | stringRequired in parent |
|
apiKey.expires_at | string | nullRequired in parent | — |
apiKey.expires_atanyOf 1 | stringRequired in parent |
|
apiKey.expires_atanyOf 2 | nullRequired in parent | — |
apiKey.last_used_at | string | nullRequired in parent | — |
apiKey.last_used_atanyOf 1 | stringRequired in parent |
|
apiKey.last_used_atanyOf 2 | nullRequired in parent | — |
apiKey.revoked_at | string | nullRequired in parent | — |
apiKey.revoked_atanyOf 1 | stringRequired in parent |
|
apiKey.revoked_atanyOf 2 | nullRequired in parent | — |
apiKey.status | stringRequired in parent |
|
apiKey.replaces | object | nullRequired in parent | — |
apiKey.replacesanyOf 1 | objectRequired in parent | — |
apiKey.replaces.idanyOf 1 | stringRequired in parent |
|
apiKey.replaces.nameanyOf 1 | stringRequired in parent | — |
apiKey.replaces.last_4anyOf 1 | stringRequired in parent | — |
apiKey.replaces.statusanyOf 1 | stringRequired in parent |
|
apiKey.replacesanyOf 2 | nullRequired in parent | — |
apiKey.replaced_by | arrayRequired in parent | — |
apiKey.replaced_by[] | objectOptional / item | — |
apiKey.replaced_by[].id | stringRequired in parent |
|
apiKey.replaced_by[].name | stringRequired in parent | — |
apiKey.replaced_by[].last_4 | stringRequired in parent | — |
apiKey.replaced_by[].status | stringRequired in parent |
|
apiKey.capabilities | arrayOptional / item | — |
apiKey.capabilities[] | stringOptional / item |
|
apiKey.workspace_ids | array | nullOptional / item | — |
apiKey.workspace_idsanyOf 1 | arrayOptional / item | — |
apiKey.workspace_ids[]anyOf 1 | stringOptional / item |
|
apiKey.workspace_idsanyOf 2 | nullOptional / item | — |
apiKey.created_by_delegated_grant_id | string | nullOptional / item | — |
apiKey.created_by_delegated_grant_idanyOf 1 | stringOptional / item |
|
apiKey.created_by_delegated_grant_idanyOf 2 | nullOptional / item | — |
idempotent | booleanRequired in parent | — |
Complete JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"apiKey": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"name": {
"type": "string"
},
"last_4": {
"type": "string"
},
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"created_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
"expires_at": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
{
"type": "null"
}
]
},
"last_used_at": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
{
"type": "null"
}
]
},
"revoked_at": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
},
{
"type": "null"
}
]
},
"status": {
"type": "string",
"enum": [
"active",
"expired",
"revoked"
]
},
"replaces": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"name": {
"type": "string"
},
"last_4": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"active",
"expired",
"revoked"
]
}
},
"required": [
"id",
"name",
"last_4",
"status"
]
},
{
"type": "null"
}
]
},
"replaced_by": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"name": {
"type": "string"
},
"last_4": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"active",
"expired",
"revoked"
]
}
},
"required": [
"id",
"name",
"last_4",
"status"
]
}
},
"capabilities": {
"type": "array",
"items": {
"type": "string",
"enum": [
"agent:operate",
"agent:publish",
"agent:engage"
]
}
},
"workspace_ids": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
}
},
{
"type": "null"
}
]
},
"created_by_delegated_grant_id": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"name",
"last_4",
"scopes",
"created_at",
"expires_at",
"last_used_at",
"revoked_at",
"status",
"replaces",
"replaced_by"
]
},
"idempotent": {
"type": "boolean"
}
},
"required": [
"apiKey",
"idempotent"
]
}Errors and safe retries
Check the HTTP status and response body. A 400 validation error may contain a ZodError; handler errors use error, message and code fields. Keep request_id or x-request-id for diagnosis, without credentials. Fix 401/403 access errors before retrying, and follow Retry-After for 429. If a write is uncertain or returns 5xx, read the existing result first. Reuse an idempotency key only where supported; retry behaviour varies by operation and does not guarantee exactly-once delivery.
Troubleshooting guideExamples
These examples use fictional values checked against the schemas. Replace the IDs with ones you are authorized to use, the media with ready assets and the dates with your confirmed publishing time. Check the account’s eligibility before submitting a write. This page sends no API requests.
Set SOSOAPI_ACCESS_TOKEN on your server to a credential accepted by this operation, and keep it out of browser code. For an agent, use sosoapi auth login to sign in through the browser and let the CLI refresh its credentials.
request.json
{
"id": "11111111-1111-4111-8111-111111111111",
"expires_at": "2099-01-15T09:00:00Z"
}cURL
curl --request POST \
"https://gqeshlawtcexsapabaui.supabase.co/functions/v1/identity-api/api-keys/extend" \
-H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @request.jsonJavaScript
// Server-side JavaScript. Do not print tokens or credential-bearing responses.
const token = process.env.SOSOAPI_ACCESS_TOKEN;
if (!token) throw new Error("Set an accepted credential for this operation");
const response = await fetch("https://gqeshlawtcexsapabaui.supabase.co/functions/v1/identity-api/api-keys/extend", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
body: JSON.stringify({
"id": "11111111-1111-4111-8111-111111111111",
"expires_at": "2099-01-15T09:00:00Z"
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.CLI
npx sosoapi api post /identity-api/api-keys/extend < request.jsonSynthetic response example
{
"apiKey": {
"id": "11111111-1111-4111-8111-111111111111",
"name": "example",
"last_4": "example",
"scopes": [],
"created_at": "2099-01-15T09:00:00Z",
"expires_at": null,
"last_used_at": null,
"revoked_at": null,
"status": "active",
"replaces": null,
"replaced_by": []
},
"idempotent": false
}