Connect a connector - Spacefast Docs

Connect a connector

One call to connect anything. The answer is connected, authorization_required with a URL to open, or input_required with the fields to collect — branch on status; there is no fourth. Credentials are write-only and never come back.

POST /v1/connectors/connections

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

cURL Example

curl -X POST "https://api.spacefast.com/v1/connectors/connections" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "connector": "string",
  "owner": "team",
  "displayName": "string",
  "description": "string",
  "authMethod": "string",
  "credential": {
    "kind": "api_key",
    "value": "string"
  },
  "scopes": [
    "string"
  ],
  "returnPath": "string"
}'

JavaScript Example

const response = await fetch("https://api.spacefast.com/v1/connectors/connections", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"connector\": \"string\",\n  \"owner\": \"team\",\n  \"displayName\": \"string\",\n  \"description\": \"string\",\n  \"authMethod\": \"string\",\n  \"credential\": {\n    \"kind\": \"api_key\",\n    \"value\": \"string\"\n  },\n  \"scopes\": [\n    \"string\"\n  ],\n  \"returnPath\": \"string\"\n}"
});

Python Example

import requests

response = requests.post(
    "https://api.spacefast.com/v1/connectors/connections",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"connector\": \"string\",\n  \"owner\": \"team\",\n  \"displayName\": \"string\",\n  \"description\": \"string\",\n  \"authMethod\": \"string\",\n  \"credential\": {\n    \"kind\": \"api_key\",\n    \"value\": \"string\"\n  },\n  \"scopes\": [\n    \"string\"\n  ],\n  \"returnPath\": \"string\"\n}",
)

Response Example

200 Default Response

{
  "$schema": "http://example.com",
  "data": {
    "status": "connected",
    "connection": {
      "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 Example

{
  "$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"
}