The Product API is available in the following environments. Send all requests to the base URL for the environment you are targeting.
| Environment | Base URL | Purpose |
|---|---|---|
| Sandbox | https://api.sandbox.aiwyn.app | Runs the latest development build. Use for early integration and experimentation. |
| Staging | https://api.staging.aiwyn.app | Mirrors production behavior and stability. Use for pre-release validation. |
| Production | https://api.aiwyn.ai | Your firm's live data. |
Each environment has its own API keys: a key issued for Sandbox does not work on Staging or Production. All three are selectable as the server in the API reference's Try it panel. Requests made there against Production read and change live data.
Authenticate every request with a bearer token. See Authentication, or the Quickstart for the whole flow.
Every path carries the API version, v1, and starts with one of three prefixes. The prefix tells you how the endpoint behaves:
| Prefix | Used for | Conventions |
|---|---|---|
/v1/auth/ | Token exchange | POST /v1/auth/token only. |
/gql/v1/ | Reading records | List: POST /gql/v1/clients with { "pageSize", "page" } in the body. Search: POST /gql/v1/clients/search, which adds where and orderBy. By id: GET, usually under the singular resource name, as in GET /gql/v1/client/{id}. Responses are keyed by the resource name, with total.aggregate.count on lists and searches. See Pagination. |
/api/v1/ | Creating, changing, and deleting records; records, codes, and entries; event subscriptions; files | Standard HTTP methods on resource paths. Most responses use the { data, error, meta } envelope; each endpoint's reference page shows its exact body. |
Two client endpoints repeat the version: POST /api/v1/clients/v1/onboard and POST /api/v1/clients/v1/link/payment. The second v1 is part of their path and does not mean anything; they are ordinary v1 endpoints and keep these paths for as long as v1 is supported.
The Sandbox and Staging environments sit behind Cloudflare Access. In addition to your Aiwyn credentials, every request to these environments, including POST /v1/auth/token, must carry a Cloudflare Access service token. Production does not use Cloudflare Access; send only your Aiwyn credentials there.
| Header | Value |
|---|---|
CF-Access-Client-Id | The Cloudflare Access client ID issued to you by Aiwyn |
CF-Access-Client-Secret | The Cloudflare Access client secret issued to you by Aiwyn |
curl --request POST 'https://api.staging.aiwyn.app/gql/v1/clients' \
--header 'CF-Access-Client-Id: <cf-access-client-id>' \
--header 'CF-Access-Client-Secret: <cf-access-client-secret>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "pageSize": 5, "page": 0 }'- The Cloudflare Access credentials are separate from your Aiwyn API key. They only get the request past Cloudflare; the API still authenticates and authorizes it with your API key or bearer token.
- Each environment has its own client ID and secret. Contact api-support@aiwyn.ai to request them.
- Treat the client secret like a password: keep it server-side and out of source control.
- A request without valid Cloudflare Access headers is rejected by Cloudflare before it reaches the API, so the response is Cloudflare's, not the JSON error body described in Errors.