---
title: 'Create a new subscription (blockchain or snag)'
description: 'This endpoint allows you to create a stratus subscription, which runs its associated functions and calls its callback URL whenever a matching event is detected. Provide either `blockchainSubscriptions`, for contract events or function calls to watch on a given chain, or `snagSubscriptions`, for changes to Snag platform tables. Exactly one of the two is required — sending both, or neither, is rejected.'
openapi: POST /api/stratus/subscriptions
---

> **For AI agents:** the complete documentation index is at [llms.txt](https://docs.snagsolutions.io/llms.txt). Append `.md` to any page URL for its markdown version.

`POST /api/stratus/subscriptions`

`POST https://admin.snagsolutions.io/api/stratus/subscriptions`

This endpoint allows you to create a stratus subscription, which runs its associated functions and calls its callback URL whenever a matching event is detected. Provide either `blockchainSubscriptions`, for contract events or function calls to watch on a given chain, or `snagSubscriptions`, for changes to Snag platform tables. Exactly one of the two is required — sending both, or neither, is rejected.

## Authentication

- `apiKeyAuth` — apiKey in header: `X-API-KEY`

## Request body

- Content type: `application/json`
  - request body (object)
    - `name` (string, required)
    - `websiteId` (string, required)
    - `organizationId` (string, required)
    - `functionIds` (array)
      - `items` (string)
    - `callbackUrl` (string, uri) — Must be the one below!!
    - `startsAt` (string)
    - `endsAt` (string)
    - `maxEventsPerDay` (number)
    - `blockchainSubscriptions` (array)
      - `items` (object)
        - `triggerId` (string)
        - `chainId` (number, required)
        - `contractAddress` (string, required)
        - `blockchainSubscriptionType` (string, required, one of: EVENT, FUNCTION)
        - `eventAbi` (string)
        - `functionAbi` (string)
        - `fromBlock` (string)
    - `snagSubscriptions` (array)
      - `items` (object)
        - `triggerId` (string)
        - `tableNames` (array, required)
          - `items` (string)
        - `mainLoyaltyAccountIds` (array)
          - `items` (string)

## Response 200

200
  - response (object)
    - `name` (string, required)
    - `websiteId` (string, required)
    - `organizationId` (string, required)
    - `functionIds` (array)
      - `items` (string)
    - `callbackUrl` (string, required)
    - `startsAt` (string)
    - `endsAt` (string)
    - `id` (string, required)
    - `version` (string, one of: v1, v2)
    - `signingKey` (string, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `deletedAt` (string, date-time, required)
    - `disabled` (boolean)
    - `disabledAt` (string, date-time)
    - `disabledReason` (string)
    - `consecutiveFailures` (number)
    - `blockchainSubscriptions` (array)
      - `items` (object)
        - `id` (string, required)
        - `chainId` (number, required)
        - `contractAddress` (string, required)
        - `blockchainSubscriptionType` (string, required, one of: EVENT, FUNCTION)
        - `eventSelector` (string, required)
        - `eventAbi` (string, required)
        - `functionAbi` (string, required)
        - `fromBlock` (string, required)
        - `createdAtBlock` (string, required)
        - `createdAt` (string, date-time, required)
        - `updatedAt` (string, date-time, required)
        - `deletedAt` (string, date-time, required)
    - `snagSubscriptions` (array)
      - `items` (object)
        - `id` (string, required)
        - `table` (string, required)
        - `createdAt` (string, date-time, required)
        - `updatedAt` (string, date-time, required)
        - `deletedAt` (string, date-time, required)

## Response 400

400
  - response (object)
    - `error` (string, required)

## Response 409

409
  - response (object)
    - `name` (string, required)
    - `websiteId` (string, required)
    - `organizationId` (string, required)
    - `functionIds` (array)
      - `items` (string)
    - `callbackUrl` (string, required)
    - `startsAt` (string)
    - `endsAt` (string)
    - `id` (string, required)
    - `version` (string, one of: v1, v2)
    - `signingKey` (string, required)
    - `createdAt` (string, date-time, required)
    - `updatedAt` (string, date-time, required)
    - `deletedAt` (string, date-time, required)
    - `disabled` (boolean)
    - `disabledAt` (string, date-time)
    - `disabledReason` (string)
    - `consecutiveFailures` (number)
    - `blockchainSubscriptions` (array)
      - `items` (object)
        - `id` (string, required)
        - `chainId` (number, required)
        - `contractAddress` (string, required)
        - `blockchainSubscriptionType` (string, required, one of: EVENT, FUNCTION)
        - `eventSelector` (string, required)
        - `eventAbi` (string, required)
        - `functionAbi` (string, required)
        - `fromBlock` (string, required)
        - `createdAtBlock` (string, required)
        - `createdAt` (string, date-time, required)
        - `updatedAt` (string, date-time, required)
        - `deletedAt` (string, date-time, required)
    - `snagSubscriptions` (array)
      - `items` (object)
        - `id` (string, required)
        - `table` (string, required)
        - `createdAt` (string, date-time, required)
        - `updatedAt` (string, date-time, required)
        - `deletedAt` (string, date-time, required)

## Response 429

429
  - response (object)
    - `error` (string, required)

## Response 500

500
  - response (object)
    - `error` (string, required)


---

📦 **OpenAPI specs:** Every OpenAPI specification referenced by this documentation is available as a single download — https://docs.snagsolutions.io/api-specs.zip
