Projects and content
Set active project
Set which project is the user's active one (a server-side default).
POST /studio-api/projects/set-activeContract reviewed: · sha256:563d2d581da0ad29
Overview
Set which project is the user's active one (a server-side default).
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 |
|
project_id | stringRequired in parent |
|
Complete JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"project_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)$"
}
},
"required": [
"project_id"
],
"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 | — |
ok | booleanRequired in parent |
|
active_project_id | stringRequired in parent |
|
Complete JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"const": true
},
"active_project_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)$"
}
},
"required": [
"ok",
"active_project_id"
]
}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
{
"project_id": "11111111-1111-4111-8111-111111111111"
}cURL
curl --request POST \
"https://gqeshlawtcexsapabaui.supabase.co/functions/v1/studio-api/projects/set-active" \
-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/studio-api/projects/set-active", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
body: JSON.stringify({
"project_id": "11111111-1111-4111-8111-111111111111"
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.CLI
npx sosoapi api post /studio-api/projects/set-active < request.jsonSynthetic response example
{
"ok": true,
"active_project_id": "11111111-1111-4111-8111-111111111111"
}