Set up your environment

Choose the project your webhooks belong to, and set up the address and API key your requests use.

Before you create a source, choose the project it belongs to and set up how your code calls the webhooks API.

Choose a project

Sources, destinations, and connections belong to one project, and the people and keys that can reach that project can reach them. Use one project for each app and environment, so webhooks for your live app are kept apart from the ones you are testing.

  1. In the console, open the project switcher in the header and select the project, or create one.
  2. Open Settings for the project.
  3. Copy the Project ID. Every API path for webhooks includes it.

Set up authentication

Every request to the API carries an API key as a bearer token. Create one in the console with the Webhooks service and the permissions your code needs:

PermissionLets the key
ViewList and read sources, destinations, connections, events, and deliveries
CreateCreate sources, destinations, and connections
Edit and resendChange them, reset a source’s address, read and reset signing secrets, send deliveries again, cancel them, and try transformations
DeleteDelete sources, destinations, and connections

See API keys.

Authorization: Bearer dsk_…

A missing, unknown, or expired key gets Authentication required. A key without the permission, or not allowed in the project, gets Forbidden.

Set your environment variables

Send every request to https://hooks-api.digitospace.com. The examples in these guides read your key, your project, and the project’s address from environment variables:

export HOOKS_API_KEY="dsk_…"
export PROJECT_ID="your-project-id"
export HOOKS_URL="https://hooks-api.digitospace.com/v1/projects/$PROJECT_ID"

Replace the key and project with your own.

Check it works

List the project’s sources. A new project answers with an empty list:

curl "$HOOKS_URL/sources" \
  -H "Authorization: Bearer $HOOKS_API_KEY"
{
  "data": [],
  "meta": {
    "requestId": "01m3c081dbf3j55x7hsa7wc1yj",
    "page": { "limit": 50, "nextCursor": null }
  }
}

What’s next

Last updated