Postman collection
The gateway ships a Postman collection generated from its OpenAPI document, with one folder per API tag and a request for every endpoint, plus an environment file holding the two variables the collection needs. Use it to explore the management API, to try a request before scripting it, or to hand a reviewer a reproducible call.
Download spanway.postman_collection.json and spanway.postman_environment.json from the release page of the gateway version you run. Each release attaches both files with the other release assets, listed in SHA256SUMS and each signed with cosign, so you can check them as described in release assets. The files on a release are generated from that gateway version's OpenAPI document, so they match it.
A real-world scenario
A reviewer wants to try the key management API before approving a script that uses it. They import the collection, point the environment at the staging gateway with a test key, and send Create a virtual key with a team id, so they see the exact request and response the script will get.
Before you start
- Postman, the desktop app or the web app. The web app needs the Postman desktop agent to reach a gateway on
localhostor a private network. spanway.postman_collection.jsonandspanway.postman_environment.jsonfrom the release page of the gateway version you run.- The gateway's address, and a key for the collection, made as in the next section.
Make a key for Postman
Use a test key of its own for Postman, so the requests you try are easy to find on Logs and cannot spend more than a few dollars.
- Sign in to the Admin UI as a proxy admin, open Virtual Keys (
/ui/api-keys) and click + Create New Key. - Under Key Details, set Key Name to who and what, for example
jane-postman. Pick the Key Type. AI APIs is enough for the model routes. For the management folders pick Management, or Full Access when one key should try both, and make the key as a proxy admin, because only a proxy admin's key may call the team, user and model management routes. - In Models, pick the models you want to try, for example
claude-haiku-5-5. With Management the field is switched off, because that key type calls no model. - Open Optional Settings. Set Max Budget (USD) to a few dollars, for example
5, with Reset Budget on monthly, and Requests per minute Limit (RPM) to30. - Click Create Key and copy the key into
apiKeyin the environment. It is shown once.
The same test key for the model routes from the API, with the master key:
curl -X POST https://gateway.example.com/key/generate \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{"key_alias": "jane-postman", "key_type": "llm_api", "models": ["claude-haiku-5-5"], "max_budget": 5, "budget_duration": "30d", "rpm_limit": 30}'
Steps
The numbered steps under Importing cover Postman. Before you start, check that the key you put in apiKey works. /key/info answers for any live key, so it proves the key is valid, not that it may manage the gateway.
curl http://localhost:4000/key/info -H "Authorization: Bearer $SPANWAY_API_KEY"
The management folders, such as key management and team management, need the master key or a key owned by a proxy admin. A key whose Key Type is AI APIs, or a key with no user, can call the model routes and read its own /key/info, but the management routes refuse it. A key owned by an internal user can also create and manage that user's own keys, and only the master key or a proxy admin's key can call the team, user and model management routes. To get a key for the collection from the Admin UI, sign in as a proxy admin, open Virtual Keys, click + Create New Key, and copy the key from the dialog that appears after Create Key. A key you create this way is owned by your admin user, so it may call the management routes too.
Expected result
Every request in the collection runs against {{baseUrl}} with the bearer token from {{apiKey}}, and a request such as key management > Create a virtual key answers 200 with the new key when apiKey is an admin key. The collection has no pre-request or test scripts, so every request is sent exactly as you see it.
Importing
- In Postman, choose Import and drop in
spanway.postman_collection.json. The collection appears as Spanway AI Gateway with a folder per tag, for examplekey management,team management,evals,cloudandguardrails. - Import
spanway.postman_environment.jsonthe same way. It creates an environment named Spanway AI Gateway (local). - Select that environment in the top right corner and open its variables. Set
baseUrlto your gateway, such ashttp://localhost:4000orhttps://gateway.example.com, and setapiKeyto the master key or an admin's virtual key for the management folders, or to any virtual key for the model routes. TheapiKeyvariable is marked secret so it is masked in the UI and left out of exports. - Open any request, for example key management > Create a virtual key, edit the example body and send it.
Authentication is configured once at the collection level as a bearer token whose value is {{apiKey}}. Every request that needs a key inherits it, so there is nothing to set per request and changing the environment switches every call to another gateway or another key. Routes that take no key, such as the health probes and the workload identity token exchange, are set to No Auth, so the collection never sends your key to a route that does not need it. Each request's URL starts with {{baseUrl}}, and the collection also carries baseUrl and apiKey as collection variables as a fallback when no environment is selected.
Request bodies, form fields, query parameters and saved responses are filled from the examples in the OpenAPI document, so most requests can be sent as they are once the ids in them are yours. When a route documents several answers for one status, for example two different 400 messages, each one is its own saved response, named after its message, so you can see every error the route can return. A validation error that the document describes only by its shape is saved as a realistic 422 body naming the field it would complain about. Where the document has no example, a field holds a placeholder such as <string> or <integer> instead. Each folder carries a plain-English description of what its routes are for, and routes that belong to no group sit in the other routes folder. When a folder holds the same request name twice, such as a route with and without /v1, each name ends in its method and path. Each request's description carries the endpoint's documentation, including the parameter list and the equivalent curl call where the gateway documents one. Optional query parameters are included but disabled, so a request sends only what you switch on.
Send a model call
The collection holds the model routes next to the management API, so the same environment can try a prompt. A plain virtual key is enough for these requests, and the best key for it is a test key of its own with a small budget, made as in make a key for a tool, with Max Budget (USD) set to a few dollars. Keep baseUrl without /v1, because every request URL in the collection already carries the full path.
-
Open model management > List the models this key can call (
GET {{baseUrl}}/v1/models) and click Send. The answer lists the public model names the key may call. -
Open chat/completions > Create a chat completion (POST /v1/chat/completions). The folder also has the same route without
/v1, and both work. -
On the Body tab, replace the example with your own body. Delete every field you do not need, and any placeholder such as
<string>left in it, because it is sent as that text.{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Say hello in five words."}]} -
Click Send. The answer is the model's reply in
choices[0].message.content, withusagefor the tokens. -
Open the Headers tab of the answer.
x-spanway-call-idis the id to search for on Logs,x-spanway-response-costis the cost, andx-spanway-model-group,x-spanway-model-id,x-spanway-routing-reasonandx-spanway-attemptssay which deployment served it, see routing headers.
The other model routes work the same way. responses > Create a model response posts to /v1/responses with input and model, embeddings > Create embeddings posts to /v1/embeddings with input and an embedding model such as text-embedding-3-large, and anthropic_passthrough > Create a message (Anthropic Messages format) posts to /v1/messages, which also needs max_tokens in the body. The collection's bearer token works on all of them.
Streaming. Add "stream": true to the chat body and send it. Postman shows the server-sent events one by one in the answer pane, each a data: line with a chunk of the reply, ending with data: [DONE].
Tools and images. Add a tools list or an image part to messages exactly as in chat completions. The request builder sends whatever JSON you write.
WebSocket and MCP. The WebSocket folder and the MCP requests are listed for reference, but a plain HTTP request cannot hold those connections open. Use a Postman WebSocket request for /v1/realtime, or an MCP client for /mcp.
Keeping it current
The collection attached to a release matches that release's routes. To get one for exactly what your gateway runs, including routes a plugin or an enterprise feature adds, download the running gateway's OpenAPI document with a key and import it into Postman with Import, which builds a collection from it.
curl -s http://localhost:4000/openapi.json -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -o spanway-openapi.json
The document is served at /openapi.json to signed-in users only, so the request must carry your own key, see API docs and build details. The admin can move it with OPENAPI_URL or turn it off with NO_OPENAPI=True. OPENAPI_URL wins when both are set, and with NO_OPENAPI alone the route answers 404.
For scripting rather than exploring, use the TypeScript client or the Python client, which are generated from the same document.
Errors
The answer pane shows the gateway's JSON for errors the gateway returned, and Postman's own Could not send request panel when it never reached the gateway. The client error reference lists every gateway error.
| What you see | What it means | Fix |
|---|---|---|
401 with Authentication Error, No api key passed in. on every request | apiKey is empty, or no environment is selected and the collection fallback is empty. | Select Spanway AI Gateway (local) and set apiKey. |
401 with Authentication Error, Invalid proxy server token passed | The key is wrong, blocked or deleted. | Copy the key again, or create a new one in Virtual Keys. |
401 Authentication Error, Only proxy admin can be used to generate, delete, update info for new keys/users/teams. | apiKey is a plain virtual key and the request is a management route. | Use the master key or a key created by a proxy admin. |
403 with The requested model '<model>' is not available for this API key, or the model name is invalid. | The key may not use the model in the body. | Use a name from List the models this key can call, or add the model to the key. |
400 with Invalid model name passed in model=<name> | The model is a placeholder or a name no deployment carries. | Use a name from List the models this key can call, typed exactly. |
422 with a detail list | The example body still holds placeholders such as <string> or fields with the wrong type. | Replace the placeholders with real values, or delete the fields. |
422 with Budget has been exceeded! | The key's budget is spent. | Raise Max Budget (USD) on the test key, or wait for the reset. |
429 with Rate limit exceeded for <scope>: <value>. | The key is over its RPM or TPM limit, often from the Runner. | Wait for the window, or lower the run's speed with a delay between requests. |
404 Not Found on every request | baseUrl ends in /v1, so the requests go to /v1/v1/.... | Set baseUrl to the bare address, such as https://gateway.example.com. |
404 on /openapi.json | The request carried no key, or a key that belongs to no person, or the gateway sets NO_OPENAPI=True, or serves the document at the path in OPENAPI_URL. | Ask the admin for the path, or import the collection attached to the release instead. |
Could not send request with Error: connect ECONNREFUSED | baseUrl points at a gateway Postman cannot reach. | Check the URL and that the gateway is running, curl $baseUrl/health/liveliness. |
Could not send request with unable to verify the first certificate or self signed certificate in certificate chain | The gateway's certificate comes from a company authority Postman does not trust. | Add the company root certificate under Settings, Certificates, CA certificates. Turning off SSL certificate verification under Settings, General is for a test gateway only. |
Troubleshooting
- Open the Postman Console with View, Show Postman Console. It shows the exact URL, headers and body Postman sent, which catches a doubled
/v1, an emptyAuthorizationheader or a placeholder left in the body. - Open Logs (
/ui/logs) in the Admin UI, click Filters, pick the key in Key Alias and click Apply Filters, or search for thex-spanway-call-idfrom the answer's Headers tab. A row means the request reached the gateway, and its drawer shows the status, the error and the deployment the router picked. No row means it never arrived, so checkbaseUrland TLS. - A management request that fails with 401 or 403 needs a stronger key, not a fix to the body. Check who owns the key in
apiKeywith key management > Get a key's settings and spend.
Rotate or remove the key
The key lives only in the environment's apiKey variable, which is secret and left out of exports. To rotate it, create or regenerate the key in Virtual Keys, paste the new value into apiKey and save the environment. To remove access, block or delete the key in Virtual Keys and clear apiKey. Never paste a key into a request's own Authorization tab, because that copy is saved with the collection and can be exported with it.
Logs
Postman keeps its own history of what it sent in the Postman Console, as the troubleshooting steps above describe. On the gateway every request from the collection is an ordinary request, so it shows up on Logs (/ui/logs) under the key in apiKey, and a management request that changes something, such as key management > Create a virtual key, also writes a row to the audit log with the key's user as the actor. The gateway's log lines are in the log reference.
Related
- TypeScript client and Python client for scripting.
- API Reference page for the same routes inside the Admin UI.
- Error reference for every error status.
- Connect any client for the base URL and key header of every route.