Quickstart
GetPaid GraphQL API is in alpha build and is subject to change without warning. While the overall schemas will not vary much, the fields could undergo major revision. (see GraphQL Best Practices for Versioning (opens in a new tab))
Prerequisites
Authentication
Every request needs an API key, sent as Authorization: Bearer <API_KEY>.
Partner admins create keys in the GetPaid dashboard. There are two kinds:
| Key prefix | Use it against | Data |
|---|---|---|
gp_test_ | Sandbox endpoint | Test data only, no real disbursements |
gp_live_ | Production endpoint | Live data and real disbursements |
- A key is shown only once, when it is created. Store it in your server's secret store (for example an environment variable). GetPaid cannot show it again.
- Never use API keys in browsers or mobile apps. Call the API from your servers only.
- A test key is rejected by the production endpoint, and a live key by the sandbox.
Rotating keys
Keys do not expire unless an expiry was set when they were created. To rotate without downtime:
- Create a new key in the dashboard (you can have up to two active keys per mode).
- Deploy the new key to your servers.
- Check the old key's "last used" time has stopped changing, then revoke it. You can revoke immediately or schedule it after a delay.
If a key leaks, revoke it immediately and contact GetPaid.
The GraphQL endpoint
| Environment | Endpoint |
|---|---|
| Sandbox | https://partner.getpaid.technology/api/graphql |
| Production | https://partner.getpaid.asia/api/graphql |
These endpoints will not change regardless of version or call type.
Making a Call
Communicating with the GraphQL API
GraphQL requires sending data in the form of multiline JSON.
To query GraphQL using cURL, make a POST request with a JSON payload. The payload must contain a string called query (or mutation).
The request must also include a header with Authorization populated with your API key.
curl -H "Content-Type: application/json" -H "Authorization: Bearer <API_KEY>" -X POST -d " \
{ \
\"query\": \"query { viewer { login }}\" \
} \
" https://partner.getpaid.technology/api/graphqlWhile constructing curl commands is the most basic way of communicating, formatting an object can get cumbersome very quickly. There are many libraries that make this process easier. GetPaid recommends using one of the following libraries:
- Apollo Client (opens in a new tab)
- Urql (opens in a new tab)
- SWR (opens in a new tab)
- React Query (opens in a new tab)
An Example Query
query{
user(userId: "USER_ID") {
id
active
email
name
}
}Next Steps
If you have any questions or need to report a bug related to the GetPaid API, please send an email to dev@getpaid.com and we will respond as soon as possible.