Synq Docs
Management APIToken gates

Gate sign-in on what wallets hold

A gate on brands, apps or both: signing in to one of them, the person's wallets must meet its `rule`, or a page tells them why not (with `refusal_message` first) and the app gets `access_denied`. `rule` is a tree of `all` and `any` groups (at most 3 deep, each with 1 to 20 children, 20 conditions in all) of conditions on the wallets on the person's account in the brand: `token` (hold at least `min_amount` of a mint, every account and compressed balance of it counted), `collection` (hold at least `min_count` NFTs of a verified Core or Token Metadata collection, compressed and Core NFTs included), `nft` (hold one NFT) and `allowlist` (have a wallet on a list of at most 1000 addresses a gate, never shown to anyone). `token` and `collection` count every wallet together (`wallets: combined`, the default) or one alone (`single`). Each condition names its `chain`, which must be one this API reads (the list's `chains`) unless it is an allowlist. Synq reads every token, collection and NFT the rule names from the chain as it is written (400 for one that isn't what its condition says, at its path, such as `rule.root.conditions.1.collection`; 503 when the chain can't be read), once nothing else in the request is wrong and from the org's own reads (`token_gate.org_reads`, as its dry runs; 429 once they're spent), and keeps their names as each condition's `display`. `schedule` is an optional window in an IANA time zone, open at one end or both, with what happens `outside` it: `let_in` (the gate doesn't apply) or `refuse` (the app is closed to everyone). A sign-in reads at most 40 conditions from the chain across every enabled gate on an app (409 `conflict` naming the app otherwise). Gates are checked at every sign-in and on every refresh, where a refusal or a closed window ends the app's grant (`invalid_grant`), so access ends within one access token's life; what can't be read refuses a sign-in, and answers a refresh 503 `temporarily_unavailable` with the grant kept. What wallets hold is kept for a minute. Every check is recorded as `user.token_gate_checked`. At most 100 gates per org. Needs `org.tokenGates.edit`, a plan with token gating (403 `plan_feature_unavailable` otherwise, naming the plan in `required_plan`) and, for a rule that reads a chain, an API that reads one (409 `token_gates_unavailable` otherwise). Recorded as `token_gate.created`.

POST/v1/orgs/{org}/token-gates

A gate on brands, apps or both: signing in to one of them, the person's wallets must meet its rule, or a page tells them why not (with refusal_message first) and the app gets access_denied. rule is a tree of all and any groups (at most 3 deep, each with 1 to 20 children, 20 conditions in all) of conditions on the wallets on the person's account in the brand: token (hold at least min_amount of a mint, every account and compressed balance of it counted), collection (hold at least min_count NFTs of a verified Core or Token Metadata collection, compressed and Core NFTs included), nft (hold one NFT) and allowlist (have a wallet on a list of at most 1000 addresses a gate, never shown to anyone). token and collection count every wallet together (wallets: combined, the default) or one alone (single). Each condition names its chain, which must be one this API reads (the list's chains) unless it is an allowlist. Synq reads every token, collection and NFT the rule names from the chain as it is written (400 for one that isn't what its condition says, at its path, such as rule.root.conditions.1.collection; 503 when the chain can't be read), once nothing else in the request is wrong and from the org's own reads (token_gate.org_reads, as its dry runs; 429 once they're spent), and keeps their names as each condition's display. schedule is an optional window in an IANA time zone, open at one end or both, with what happens outside it: let_in (the gate doesn't apply) or refuse (the app is closed to everyone). A sign-in reads at most 40 conditions from the chain across every enabled gate on an app (409 conflict naming the app otherwise). Gates are checked at every sign-in and on every refresh, where a refusal or a closed window ends the app's grant (invalid_grant), so access ends within one access token's life; what can't be read refuses a sign-in, and answers a refresh 503 temporarily_unavailable with the grant kept. What wallets hold is kept for a minute. Every check is recorded as user.token_gate_checked. At most 100 gates per org. Needs org.tokenGates.edit, a plan with token gating (403 plan_feature_unavailable otherwise, naming the plan in required_plan) and, for a rule that reads a chain, an API that reads one (409 token_gates_unavailable otherwise). Recorded as token_gate.created.

Authorization

bearer
AuthorizationBearer <token>

An org API key (sk_live_…, sk_test_…), or an access token from the Synq issuer (the synq brand, on the accounts host) for this API.

In: header

Path Parameters

org*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/v1/orgs/string/token-gates" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "rule": {      "version": 1,      "root": {        "type": "all",        "conditions": [          {            "type": "token",            "chain": "solana:mainnet",            "mint": "string",            "min_amount": "string"          }        ]      }    }  }'
{  "id": "string",  "name": "string",  "enabled": true,  "rule": {    "version": 0,    "root": {      "type": "all",      "conditions": [        {          "type": "token",          "chain": "string",          "mint": "string",          "min_amount": "string",          "wallets": "string",          "label": "string",          "display": {            "name": "string",            "symbol": "string",            "decimals": 0,            "image": "string"          }        }      ]    }  },  "schedule": {    "timezone": "string",    "all_day": true,    "starts": "string",    "ends": "string",    "outside": "let_in",    "starts_at": "2019-08-24T14:15:22Z",    "ends_at": "2019-08-24T14:15:22Z",    "state": "string"  },  "refusal_message": "string",  "summary": "string",  "brands": [    "string"  ],  "apps": [    "string"  ],  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}