Change a token gate
Its name, rule, schedule, message, whether it is on, or where it applies. `rule` replaces the whole tree, read from the chain again as on making a gate; `schedule: null` and `refusal_message: null` clear them; `brands` and `apps` each replace their list. The next sign-in or refresh at an app it applies to checks the change. Turning a gate on checks its rule's chains again (400), and needs a chain where the rule reads one (409 `token_gates_unavailable`). Needs `org.tokenGates.edit`. Changing its rule or schedule, turning it on, or naming brands or apps also wants a plan with token gating (403 `plan_feature_unavailable`), so an org that moved to a plan without it can still turn one off, rename it, clear its message, empty its lists or delete it. Recorded as `token_gate.updated`.
/v1/orgs/{org}/token-gates/{gate}Its name, rule, schedule, message, whether it is on, or where it applies. rule replaces the whole tree, read from the chain again as on making a gate; schedule: null and refusal_message: null clear them; brands and apps each replace their list. The next sign-in or refresh at an app it applies to checks the change. Turning a gate on checks its rule's chains again (400), and needs a chain where the rule reads one (409 token_gates_unavailable). Needs org.tokenGates.edit. Changing its rule or schedule, turning it on, or naming brands or apps also wants a plan with token gating (403 plan_feature_unavailable), so an org that moved to a plan without it can still turn one off, rename it, clear its message, empty its lists or delete it. Recorded as token_gate.updated.
Authorization
bearer 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
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 PATCH "https://example.com/v1/orgs/string/token-gates/string" \ -H "Content-Type: application/json" \ -d '{}'{ "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"}List an org's token gates GET
Every gate, on or off, with where it applies. Needs `org.tokenGates.view`.
Test a token gate or a draft rule POST
Checks a gate (`gate`), or a rule not saved yet (`rule`, with an optional `schedule`), against wallets (`wallets`, at most 10 addresses) or a user's wallets in a brand (`user` and `brand`), as a sign-in would, at `at` (an ISO time, for the window; now when left out), with what was read in the last minute unless `fresh`. Answers what each condition came to, how many reads it cost, and the refusal page's words for it. A draft is read from the chain as saving it would read it (400 at the path of what isn't what its condition says, 503 when the chain can't say), so it is tested as the gate it would be. Saves nothing. Wants the org's plan to have token gating (`auth.token_gating`, 403 `plan_feature_unavailable` otherwise), since every test may read the chain through Synq's own key. Needs `org.tokenGates.view`, and `org.users.view` to test a user, which is recorded as `user.token_gate_dry_run` (a test against addresses reads only public chain data, and isn't). Limited per org (`token_gate.dry_runs`), and reads the chain from the org's own budget (`token_gate.org_reads`), never a brand's sign-ins'.