Skip to main content

Gateway Token Management

Gateway tokens authenticate the Causely mediator agent when it connects to the Causely platform. Creating tokens via the REST API enables automated deployment pipelines, for example ArgoCD or Backstage workflows that provision a mediator without manual steps in the UI.

Prerequisite

You need a valid Bearer access token before calling this endpoint. See Authentication for how to obtain one.

Create a Gateway Token

POST https://api.causely.app/api/tokens

CAUSELY_CLIENT_ID=<YOUR_CLIENT_ID>
CAUSELY_CLIENT_SECRET=<YOUR_CLIENT_SECRET>
TOKEN_NAME=<YOUR_TOKEN_NAME>

# Obtain a Bearer access token
export CAUSELY_ACCESS_TOKEN=$(response=$(curl -s -w "\n%{http_code}" -X POST https://auth.causely.app/frontegg/identity/resources/auth/v2/api-token \
-H "Content-Type: application/json" \
-d "{\"clientId\": \"${CAUSELY_CLIENT_ID}\", \"secret\": \"${CAUSELY_CLIENT_SECRET}\"}"); \
http_code=$(echo "$response" | tail -n1); \
body=$(echo "$response" | sed '$d'); \
if [ "$http_code" = "200" ]; then echo "$body" | jq -r .access_token; else echo "$body" >&2; false; fi)

# Create a gateway token
curl -s -X POST https://api.causely.app/api/tokens \
-H "Authorization: Bearer ${CAUSELY_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"name\": \"${TOKEN_NAME}\"}"

Example Response (201 Created):

{
"id": "c2679064-c908-4bb0-9928-a0e3ce37da80",
"name": "my-mediator-token",
"tokenValue": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"mediatorId": "beb09338-3c0b-43ab-9b34-6a3fa496abf4",
"projectId": "4877d57d-6789-4838-af52-7fe9af353c9e",
"createdBy": "8df4696c-fffd-43c9-8df6-c80921471efb",
"createdByEmail": "user@example.com",
"state": "active",
"createdAt": "2026-05-26T19:16:45Z"
}
FieldDescription
idUnique identifier for this token record
nameThe name you provided
tokenValueThe token secret. Use this as mediator.gateway.token in Helm or CAUSELY_GATEWAY_TOKEN in Docker/Nomad deployments
mediatorIdID of the mediator this token is associated with
projectIdID of the project this token belongs to
createdByUser ID of the token creator
createdByEmailEmail of the token creator
stateToken status (active)
createdAtISO 8601 creation timestamp
Using tokenValue in deployments

The tokenValue from the response is the gateway token referenced throughout the installation docs. For example:

# Helm
--set mediator.gateway.token="${TOKEN_VALUE}"

# Docker
CAUSELY_GATEWAY_TOKEN="${TOKEN_VALUE}"

List Gateway Tokens

GET https://api.causely.app/api/tokens

Returns all gateway tokens for the project, including both active and revoked tokens.

curl -s -X GET https://api.causely.app/api/tokens \
-H "Authorization: Bearer ${CAUSELY_ACCESS_TOKEN}"

Example Response (200 OK):

[
{
"id": "afce85cb-70b4-4624-8198-d38843a7ccc0",
"name": "my-mediator-token",
"tokenValue": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"mediatorId": "beb09338-3c0b-43ba-9b34-6a3fa496abf4",
"projectId": "4877d57d-6789-4838-af52-7fe9af353c9e",
"createdBy": "8df4696c-fffd-43c9-8df6-c80921471efb",
"createdByEmail": "user@example.com",
"state": "active",
"createdAt": "2026-06-03T22:11:39Z"
},
{
"id": "5152a4b0-327b-46f5-8926-5716bbdd2bed",
"name": "old-mediator-token",
"mediatorId": "beb09338-3c0b-43ba-9b34-6a3fa496abf4",
"projectId": "4877d57d-6789-4838-af52-7fe9af353c9e",
"createdBy": "f67341c8-12cf-49bc-b9c7-09f44885750c",
"createdByEmail": "user@example.com",
"state": "revoked",
"revokedAt": "2026-05-26T21:36:29Z",
"revokedBy": "8df4696c-fffd-43c9-8df6-c80921471efb",
"createdAt": "2026-05-26T21:24:11Z"
}
]

The response is an array of token objects. Each object contains the same fields as the create response. Revoked tokens include additional fields:

FieldDescription
idUnique identifier for this token record
nameThe name assigned to the token
tokenValueThe token secret. Only present on active tokens
mediatorIdID of the mediator this token is associated with
projectIdID of the project this token belongs to
createdByUser ID of the token creator
createdByEmailEmail of the token creator
stateToken status: active or revoked
createdAtISO 8601 creation timestamp
revokedAtISO 8601 timestamp of when the token was revoked (revoked tokens only)
revokedByUser ID of who performed the revocation (revoked tokens only)

Revoke a Gateway Token

POST https://api.causely.app/api/tokens/{tokenId}/revoke?tokenId={tokenId}

Revoking a token immediately deactivates it. The mediator using that token will lose connectivity to the platform.

TOKEN_ID=<YOUR_TOKEN_ID>

curl -s -X POST "https://api.causely.app/api/tokens/${TOKEN_ID}/revoke?tokenId=${TOKEN_ID}" \
-H "Authorization: Bearer ${CAUSELY_ACCESS_TOKEN}"

Example Response (200 OK):

{
"id": "8323a17c-f6f5-4a7a-b04e-481790314b03",
"name": "my-mediator-token",
"mediatorId": "beb09338-3c0b-43ba-9b34-6a3fa496abf4",
"projectId": "4877d57d-6789-4838-af52-7fe9af353c9e",
"createdBy": "8df4696c-fffd-43c9-8df6-c80921471efb",
"createdByEmail": "user@example.com",
"state": "revoked",
"revokedAt": "2026-05-26T19:42:26Z",
"revokedBy": "8df4696c-fffd-43c9-8df6-c80921471efb",
"createdAt": "2026-05-26T19:42:09Z"
}
FieldDescription
staterevoked once the token has been invalidated
revokedAtISO 8601 timestamp of when the token was revoked
revokedByUser ID of who performed the revocation