Rawi

Interactive API console

Guide to the /docs/api console - choosing a server, getting a customer token, variables, sending requests, reading responses and snippets.

The API console at /docs/api is the interactive reference of the Rawi customer API, like Postman but inside the docs and built with the Rawi design system. The endpoint list, descriptions, example bodies and access levels come from /openapi.json. Admin endpoints are internal to the Rawi team and are not covered here.

Layout

AreaWhat it does
Top barServer selector, "Token", "Variables", "History" and "Download" (openapi.json and the Postman files)
Warning barReminder that requests are real, with the current server URL
Side listEndpoints by area and tag, with method badges, search and an access-level filter
Main panelDescription, access badges, parameters, body editor, headers, "Send", response, snippets, example response and errors

1. Choose a server

The default is "This deployment's default", Rawi's own API server. The "Server" menu also offers "Custom URL"; a custom URL is saved in your browser.

2. Get a token

Endpoints that need you to be signed in use a Customer token (Bearer). Token opens the "Get or paste a token" panel; use its User tab:

  1. Enter the email or mobile number of your Rawi account.
  2. Press Request code. The console calls POST /auth/request-code, the same sign-in flow as the web app.
  3. Type the code you received by email or SMS.
  4. Press Verify and get token. The token is saved in the console's own storage.

The console then shows the token masked (with a copy button) and who it belongs to (from GET /me). Sign out calls the logout route and clears the token. You can also paste an existing token ("Or paste an existing token").

3. Automatic token choice

Each endpoint says whether it needs a token, and the console sends your customer token automatically when it does. Under "Headers" you can override it for one request with "No token", for example to see a 401. When a required token is missing, a warning with a shortcut to the token panel appears.

4. Variables

As in Postman, values such as {{questionId}} or {{runId}} are substituted in the path, query and body. Defaults come from the Postman collection and can be edited in the Variables panel (saved in your browser).

The console captures common ids from responses automatically:

  • A list response stores the first item's id in the variable of that list's detail page.
  • A create response (e.g. POST /consultations) stores the new item's id.
  • *_id keys such as run_id or payment_id are stored in the matching variable (runId, paymentId).

After each capture a green note such as "Saved to variables: runId=58" appears under the response.

5. Send a request

  • Path and query parameters: path parameters are prefilled with their variable; empty query values are not sent.
  • Body: prefilled with a validated example from the Postman collection. Before sending, the console substitutes variables and validates the JSON; invalid JSON disables "Send" and shows the error. "Format" and "Reset example" are available.
  • Headers: a full preview of the request with the token masked.
  • Operations that change data: before DELETE and other requests that change your data, a confirmation dialog shows the method and full URL.

6. Read the response

The response bar shows the status (colour-coded), the time in milliseconds and the size. Tabs:

TabContent
BodyPretty, coloured JSON with a copy button; non-JSON responses (HTML, redirects) as raw text
Response headersHeaders the browser may read (only safelisted headers are exposed)
RawStatus line, headers and body text

Below every endpoint you find the "Example response" and the "Error responses" with what each status means.

7. Snippets and history

  • Snippets: cURL, JavaScript (fetch) and PHP (Laravel Http) with the same URL, headers and body. The token is not inlined; it is read from an environment variable:
bash
export RAWI_USER_TOKEN='…'   # the customer token from the Token panel
curl -X GET 'https://…/api/me' \
  -H 'Accept: application/json' \
  -H 'Accept-Language: en' \
  -H "Authorization: Bearer $RAWI_USER_TOKEN"
  • History: every request of this session (up to 100) stays in the "History" panel with status and time; click one to reopen that endpoint. History is cleared when the browser tab closes.
  • Deep links: /docs/api#get-reports-overview opens that endpoint (the OpenAPI operation id).

Production safety

On some deployments the Rawi team runs the console as a read-only reference. The "Send" button, the token panel and the history are then hidden, and you still see descriptions, parameters, examples and snippets.

API overview