SapaganDocs sapagan.com

API reference

Sending controls

Kill switches, their audit trail and the workspace's test people.

Kill switches, their audit trail and the workspace's test people.

POST /v1/scopes/{id}/pause#

Pause a store's sending (workspace keys only); reads go on; audited with reason and actor

Accepted keys Server key

Parameters

NameInTypeNotes
idpathstring required

Request body

FieldTypeNotes
reason requiredstringmin 1, max 2000
curl -X POST "$SAPAGAN_URL/v1/scopes/user-42/pause" \
  -H "Authorization: Bearer $SAPAGAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Checked with the owner"
  }'

Responses

200 OK, 400 Invalid request, 403 Forbidden, 404 Not found, 409 Conflict. Errors use the error body.

Example response 200

{
  "scopeId": "<scopeId>",
  "stored": true,
  "planCode": "<planCode>",
  "tier": "free",
  "trustTier": "red",
  "rampStep": 1,
  "reachCap": 1,
  "effectiveReachCap": 1,
  "fullReachCap": 1,
  "quotas": {},
  "monthlyQuota": {
    "push": 1,
    "email": 1,
    "inapp": 1
  },
  "dailyMax": 1,
  "effectiveDailyMax": 1,
  "campaignsPerWeek": 1,
  "allowedChannels": [
    "push"
  ],
  "frequencyCap": {},
  "segmentCooldownHours": 1,
  "contactAccess": "masked",
  "status": "<status>",
  "paused": true,
  "pausedReason": "<pausedReason>",
  "pausedAt": "<pausedAt>",
  "updatedAt": "<updatedAt>",
  "pausedBy": "<pausedBy>",
  "updatedBy": "<updatedBy>"
}

POST /v1/scopes/{id}/resume#

Resume a paused store (workspace keys only); audited

A store paused automatically for its health (P1-11) is resumed only by an operator session (a workspace key is 403 operator_required) with a reason of 3 characters or more (400 otherwise); the reason ends its automatic pause and is shown to the seller.

Accepted keys Server key

Parameters

NameInTypeNotes
idpathstring required

Request body

FieldTypeNotes
reasonstringmax 2000
curl -X POST "$SAPAGAN_URL/v1/scopes/user-42/resume" \
  -H "Authorization: Bearer $SAPAGAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Checked with the owner"
  }'

Responses

200 OK, 400 Invalid request, 403 Forbidden, 404 Not found, 409 Conflict. Errors use the error body.

Example response 200

{
  "scopeId": "<scopeId>",
  "stored": true,
  "planCode": "<planCode>",
  "tier": "free",
  "trustTier": "red",
  "rampStep": 1,
  "reachCap": 1,
  "effectiveReachCap": 1,
  "fullReachCap": 1,
  "quotas": {},
  "monthlyQuota": {
    "push": 1,
    "email": 1,
    "inapp": 1
  },
  "dailyMax": 1,
  "effectiveDailyMax": 1,
  "campaignsPerWeek": 1,
  "allowedChannels": [
    "push"
  ],
  "frequencyCap": {},
  "segmentCooldownHours": 1,
  "contactAccess": "masked",
  "status": "<status>",
  "paused": true,
  "pausedReason": "<pausedReason>",
  "pausedAt": "<pausedAt>",
  "updatedAt": "<updatedAt>",
  "pausedBy": "<pausedBy>",
  "updatedBy": "<updatedBy>"
}

GET /v1/setup/test-people#

The workspace's test people, with their names

External ids (at most 100), each with the live profile that has it and the person's name, or nulls (not known yet). key says where the list lives: recipient_allowlist in a development workspace (nobody else receives anything from it), test_people in production (who tests reach; it never limits real sends). gate: a production workspace's go-live allowlist while it is still set. Audited as a list of people.

Accepted keys Server key

curl -X GET "$SAPAGAN_URL/v1/setup/test-people" \
  -H "Authorization: Bearer $SAPAGAN_KEY"

Responses

200 OK, 403 Forbidden. Errors use the error body.

Example response 200

{
  "env": "production",
  "key": "recipient_allowlist",
  "people": [
    {
      "externalId": "user-42",
      "profileId": "user-42",
      "name": "order_placed",
      "unsubscribed": true
    }
  ],
  "gate": [
    "<gate>"
  ]
}

GET /v1/workspace/policy-audit#

The workspace's own policy history: kill switch and policy defaults changes, newest first (workspace keys only)

Accepted keys Server key

Parameters

NameInTypeNotes
limitqueryinteger
curl -X GET "$SAPAGAN_URL/v1/workspace/policy-audit" \
  -H "Authorization: Bearer $SAPAGAN_KEY"

Responses

200 OK, 403 Forbidden. Errors use the error body.

Example response 200

{
  "entries": [
    {
      "id": "user-42",
      "action": "<action>",
      "actor": "<actor>",
      "reason": "Checked with the owner",
      "before": null,
      "after": null,
      "occurredAt": "<occurredAt>"
    }
  ]
}

GET /v1/workspace/sending#

The workspace's global kill switch (workspace keys only)

Accepted keys Server key

curl -X GET "$SAPAGAN_URL/v1/workspace/sending" \
  -H "Authorization: Bearer $SAPAGAN_KEY"

Responses

200 OK, 403 Forbidden. Errors use the error body.

Example response 200

{
  "sendingEnabled": true,
  "env": "<env>"
}

PUT /v1/workspace/sending#

Turn all sending in the workspace on or off (workspace keys only); always with a reason; audited

An operator session must also send confirm, the workspace's slug typed by the operator (P1-13); without it the answer is 400 confirmation_required.

Accepted keys Server key

Request body

FieldTypeNotes
enabled requiredboolean
reason requiredstringmin 1, max 2000
confirmstringmax 100
curl -X PUT "$SAPAGAN_URL/v1/workspace/sending" \
  -H "Authorization: Bearer $SAPAGAN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "reason": "Checked with the owner"
  }'

Responses

200 OK, 400 Invalid request, 403 Forbidden. Errors use the error body.

Example response 200

{
  "sendingEnabled": true,
  "env": "<env>",
  "changed": true
}