Dashboard
APISubscription Bot Access Token Preparation API
api.botsubscription.com
GET/v1/endpoint
AuthenticationBearer
Token
Stays in this tab. Required for this endpoint — the value below is what gets sent.
Examples
curl --request GET \
  --url https://api.botsubscription.com/v1/endpoint \
  --header 'Authorization: Bearer sk_live_•••'

Prepare Subscription Bot Access Tokens

Prepare 1–100 inactive membership codes for your Telegram subscription bot or Discord subscription bot. Save the returned codes and the single batch activation ticket before activating them.

POST/v2/projects/{project_id}/access-tokens

Authorization

Bearer API KeyRequired

API key scope: access-tokens:create (required for restricted keys).

Path Parameters

project_idstringrequired

The UUID of the project.

Request Body

plan_idstringrequired

Existing plan UUID. Its configured targets determine the Telegram channels or Discord roles granted on redemption.

durationstringrequired

Access duration as a positive whole count and a full unit name, for example 1 month, 3 weeks or 4 days. Use lifetime for access without expiry.

countintegerDefault: 1

Number of codes, from 1 to 100.

notestring

Optional batch label, normalized to one line, at most 100 characters.

Duration

Use a positive whole count followed by a full unit name: second, minute, hour, day, week, month or year. Plural forms are supported, such as "3 weeks". Use "lifetime" for access without expiry. Units are case-insensitive and surrounding whitespace is ignored.

Months and years follow the UTC calendar; one year means 12 calendar months. Shorter units use exact elapsed time, so "30 days" can differ from "1 month". The maximum is 1,200 calendar months (100 years) or 3,153,600,000 elapsed seconds. The duration applies when a code is redeemed.

Missing, null, numeric, zero, fractional, absolute-date, compound and over-limit durations return 422 VALIDATION_ERROR. For example, 0, "0", 600, "0 days", "1.5 months", "2030-01-01T00:00:00.000Z", and "1 month 2 days" are invalid.

Behavior and recovery

This prepares an inactive batch and returns 201. Save the response before activating it.

Access tokens are single-use membership codes that grant a plan without a checkout. They are separate from the API key used to authenticate your requests.

The member makes no payment, and a separate zero-priced plan is not required. Redemption may still count toward the project owner's usage billing based on the plan's saved value.

  1. Prepare a batch and save each returned code and access_token_id, plus data.activation_token.
  2. Make one activation request for the entire batch, using that activation_token and the same API key within 30 minutes.
  3. Distribute activated codes privately, or use Redeem for Member to grant access from your integration, redeeming each code separately.

activation_token is a batch activation ticket, not an individual membership code. A request with count: 100 returns 100 codes and one ticket that activates all of them. Preparation has no immediate-activation option; activation is a separate REST request.

Codes, activation tickets, and claim links are bearer secrets. Store and distribute them privately. The list endpoint never returns plaintext codes, so save them before activation.

Unknown body fields are rejected.

Successful preparation responses are not replayed. Reusing a completed Idempotency-Key returns 409 IDEMPOTENCY_RESPONSE_NOT_REPLAYABLE. If the response is lost, preparing another batch cannot orphan usable codes: the lost draft was never activated.

Next, activate the saved batch. Find the plan UUID through List Plans.

Note

Response examples use the UTC ISO date format.

Last updated: