Search loads only when you use it. Browse all categories below.

Social connections

Start Instagram OAuth

Get the provider authorize_url a human must open to connect an Instagram account. Pass workspace_id. Nothing is connected until they approve and confirm in the browser.

POST /oauth-api/instagram/init

Contract reviewed: · sha256:563d2d581da0ad29

Overview

Get the provider authorize_url a human must open to connect an Instagram account. Pass workspace_id. Nothing is connected until they approve and confirm in the browser.

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

Accepted credential classes
user_session, delegated_oauth, personal_access_token
Delegated capability
agent:operate
Minimum workspace role
editor
Access scope
Resources this user is authorized to access
All-workspace consent required
No
Changes state
Yes
When the operation is complete
synchronous_http_response

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.

Request fields
Field / branchType / requiredConstraints
$objectRequired in parent
  • additionalProperties: false
redirect_tostringOptional / item
  • format: "uri"
workspace_idstringOptional / item
  • 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)$"
expected_platform_user_idstringOptional / item
  • minLength: 1
interaction_modestringOptional / item
  • enum: ["connect","request_scopes","switch_account","recover"]
  • default: "connect"
Complete JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "redirect_to": {
      "type": "string",
      "format": "uri"
    },
    "workspace_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)$"
    },
    "expected_platform_user_id": {
      "type": "string",
      "minLength": 1
    },
    "interaction_mode": {
      "default": "connect",
      "type": "string",
      "enum": [
        "connect",
        "request_scopes",
        "switch_account",
        "recover"
      ]
    }
  },
  "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.

Response and completion
Field / branchType / requiredConstraints
$objectRequired in parent—
authorize_urlstringRequired in parent
  • format: "uri"
Complete JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "authorize_url": {
      "type": "string",
      "format": "uri"
    }
  },
  "required": [
    "authorize_url"
  ]
}

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 guide

Examples

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

{}

cURL

curl --request POST \
  "https://gqeshlawtcexsapabaui.supabase.co/functions/v1/oauth-api/instagram/init" \
  -H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @request.json

JavaScript

// 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/oauth-api/instagram/init", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
  body: JSON.stringify({})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.

CLI

npx sosoapi api post /oauth-api/instagram/init < request.json

Synthetic response example

{
  "authorize_url": "https://example.com/media.png"
}

MCP: sosoapi_start_instagram_oauth