Create a webhook - Spacefast Docs

Create a webhook

Creates a webhook that delivers the subscribed activity events to a public HTTPS endpoint, and returns it. The signing secret appears only in this response. Every filter must name a known event code, and the endpoint must resolve to a public HTTPS URL.

POST /v1/webhooks

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: spaces:write

Request body

required application/json

Responses

201 Response for status 201

Show properties Hide properties

Any of:

default Error

Every 4xx and 5xx response is one RFC 9457 problem document served as application/problem+json.

Try it

Server

Base URL: https://api.spacefast.com
Custom base URL: Overrides the selected server when set.

Authorization

Bearer token Remember on this device
Include my values in samples

Body application/json

Request body

Send

Request

cURL

curl -X POST "https://api.spacefast.com/v1/webhooks" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{\n  "teamId": "string",\n  "url": "http://example.com",\n  "events": [\
    "*"\
  ]\n}'

JavaScript

const response = await fetch("https://api.spacefast.com/v1/webhooks", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json"
  },
  body: "{\n  \"teamId\": \"string\",\n  \"url\": \"http://example.com\",\n  \"events\": [\n    \"*\"\n  ]\n}"
});

Python

import requests

response = requests.post(
    "https://api.spacefast.com/v1/webhooks",
    headers={
        "Authorization": "Bearer YOUR_TOKEN",
        "Content-Type": "application/json"
    },
    data="{\n  \"teamId\": \"string\",\n  \"url\": \"http://example.com\",\n  \"events\": [\n    \"*\"\n  ]\n}",
)

Response

201 default

{
  "$schema": "http://example.com",
  "data": {
    "id": "string",
    "url": "http://example.com",
    "events": [\
      "string"\
    ],
    "status": "active",
    "secret": "string",
    "secretPreview": "string",
    "previousSecretExpiresAt": "2019-08-24T14:15:22Z",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  }
}
{
  "$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"
}