Complete an authorization - Spacefast Docs

Complete an authorization

Finishes an OAuth connect from the dashboard callback. The state addresses the attempt on its own, and replaying a consumed state returns the connection the first call made.

POST /v1/connectors/connections/complete

Authorization

Authorization Bearer token · header required

Authorization: Bearer <token>

with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).

or

Authorization OAuth2 access token · header required

OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.

Scopes: connectors:write

Query parameters

team string
min length 1 · max length 255

Request body

required application/json

Responses

200 Response for status 200

Show properties Hide properties

default Problem details

(RFC 9457). Any 4xx/5xx response is one application/problem+json document.

Try it

Server

Base URL https://api.spacefast.com

Authorization

Bearer token
Remember on this device
Include my values in samples

Parameters

state string* Opaque state from the authorization redirect. Addresses the attempt on its own.
code string* Authorization code from the provider.

Send

Request

cURL

curl -X POST "https://api.spacefast.com/v1/connectors/connections/complete" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "state": "string",
  "code": "string"
}'

JavaScript

const response = await fetch("https://api.spacefast.com/v1/connectors/connections/complete", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"state\": \"string\",\n  \"code\": \"string\"\n}"
});

Python

import requests

response = requests.post(
    "https://api.spacefast.com/v1/connectors/connections/complete",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"state\": \"string\",\n  \"code\": \"string\"\n}",
)

Response

200 default

{
  "$schema": "http://example.com",
  "data": {
    "id": "string",
    "connector": "string",
    "owner": "team",
    "displayName": "string",
    "description": "string",
    "status": "pending_authorization",
    "identityLabel": "string",
    "credentialConfigured": true,
    "authMethod": "string",
    "scopes": [
      "string"
    ],
    "isDefault": true,
    "toolCount": -9007199254740991,
    "createdBy": "string",
    "lastCheckedAt": "2019-08-24T14:15:22Z",
    "revokedAt": "2019-08-24T14:15:22Z",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  }
}

Error Response

{
  "$schema": "http://example.com",
  "type": "string",
  "title": "string",
  "status": -9007199254740991,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": [
    "string"
  ],
  "next": [
    "string"
  ],
  "requestId": "string"
}