Custom API call

Ask your own API about a member and check its answer.

A custom API call asks your own API about a member's wallet and checks a field in its answer. Use it for anything Guild can't see by itself: your app's database, an offchain leaderboard, a KYC provider, a partner's eligibility check.

Custom API call is part of the Pro plan and above. See Plans.

Set it up

  1. Under Who gets it, press Requirement and pick Custom API call.
  2. In the URL field, enter your endpoint with its path and query. Put <ACCOUNT_ID> where the member's wallet address goes, for example https://api.example.com/eligible?address=<ACCOUNT_ID>. Guild calls it once for each connected wallet, with the address in place of <ACCOUNT_ID>.
  3. Choose the HTTP method, GET or POST. For POST you can add a JSON Body of the request.
  4. Add Headers of the request if your API needs them. <ACCOUNT_ID> works in the body and headers too.
  5. In Key, enter the field of the JSON answer to check, such as eligible. In Value, enter what it must be, and pick how to compare it.
  6. Press Add requirement.

Your API should answer with a JSON object such as {"eligible": true} or {"score": 42}.

Gotchas

[!CAUTION] Treat the request as public. Anyone can reproduce it, and anything you put in the URL, body or headers may be seen by others. Never put a secret there that you can't afford to leak, and never let your API return private data.

  • Your API must answer within 10 seconds, and the answer must be at most 32 KB.
  • A GET request can't have a body.
  • Guild calls your API again when it refreshes the requirement, so keep it fast and add your own rate limiting.

Examples

  • Active app users: GET https://api.example.com/users/<ACCOUNT_ID>, Key active, Equal, true.
  • Leaderboard top 100: GET https://api.example.com/rank?wallet=<ACCOUNT_ID>, Key rank, Less than or equal to, 100.

Requirement type

This is the exact type the requirement picker offers, with its fields as you see them in the form.

Custom API call

Members connect a wallet to be checked. Needs the Pro plan or above.

Field Type Details
Body of the request Text, optional –
Headers of the request object-array, optional –
HTTP method Choice, optional One of: GET, POST.
URL of the request, including path and query params Text –
Key Text –
Value Text Compare: exactly, anything but, includes, at least, more than, at most, less than.

All Guild docs