Authentication
Every request to Meadow carries one Meadow API key. The key starts with mdw_.
Next step: export the admin key you were given and list your projects.
Samples on this page shorten IDs to eight characters after the prefix. Real IDs are longer.
Headers
Send the key in one of two headers:
You can send both headers if they carry the same key. Other schemes, such as Basic, are rejected.
On the Gemini route (/v1beta/models/... and POST /v1/models/{model}:generateContent), Meadow also reads the key from x-goog-api-key and from the key query parameter, where Gemini clients send it. Every copy you send must be the same key. Prefer the header: a query string can end up in request logs. See Gemini clients. Not on the hosted beta yet.
GET /health and GET /ready need no key.
What a bad key looks like
Every auth failure is a 401, and error.code and the message say which case you hit. On the model routes the same failure is written in the provider’s error format: see Errors on model routes.
Branch on error.code, not on the message.
More than 20 failed authentications in a minute from one address get a 429 until the minute ends. A request with a valid key is never throttled this way. See Errors.
Scopes
A key has one or more scopes. A request to a route outside the key’s scopes gets a 403.
The admin scope covers the whole account. An admin key in one project can read and change every project, every key, and every provider key in the account. Give admin only to keys that manage the account, and give workloads a key with models, sandboxes, or both.
Create a key
POST /v1/keys needs an admin key. The response contains secret once. Meadow stores only a hash of it and cannot show it again.
Any other field returns 400 with error.code parameter_unknown and the field in error.param.
The same call in Python:
And with the mdw CLI, which reads MEADOW_BASE_URL and MEADOW_API_KEY. mdw is sent to you during the beta. See Clients.
mdw prints the key in its own field order, and prints an empty limit_reset where the API returns null. The usage fields are explained under Read a key and its usage.
The key samples on this page were captured before 2026-11-28. A key object now also carries limit, usage, limit_remaining, limit_action and max_sandboxes. The table under Read a key and its usage says when each is null. A key created on the hosted beta on 2026-11-28 with "limit": 0.01 and "max_tokens": 1000 read back as:
mdw prints limit, usage, limit_remaining and limit_action, and not max_sandboxes.
Send an Idempotency-Key header with POST /v1/keys so a retry cannot create a second key. A retry by the same API key with the same Idempotency-Key and body within 24 hours returns the first response with Idempotent-Replayed: true and without secret, because Meadow keeps only a hash of a key. If you lost the first response, revoke that key by its id and create again with a new Idempotency-Key.
Child keys
A key created by another key is its child. The key that created it is its parent. A child can be equal to or narrower than its parent, never wider.
A parent with no restriction on a field puts no bound on that field in the child.
Breaking one of these rules returns 403. The message names the rule:
Every one of these has error.code key_grant_exceeds_parent. error.param names the field, and the message gives the calling key’s own bound. The message above is from the server build after 2026-11-25.
A child spends its parent’s limits
A child’s requests and tokens count against the child and against every key above it. Size a parent’s limits for all of its children together.
In this run the parent had max_requests: 3 and its child had max_requests: 2. The child made two calls and its third was rejected. The parent then made one call, and its next was rejected, because the child’s two calls had already counted against the parent’s three.
That is the child’s third call. The parent’s rejection reads 3 of 3 requests used on this key. The code is key_token_limit_exceeded for a token limit. When the limit that stopped a call belongs to a key above the caller, the message is api key max_tokens limit reached with no numbers.
A key that hits a limit stays at the limit until its counters reset, or until you raise the limit. Three things help:
- Set
limit_resetwhen you create the key, todaily,weeklyormonthly. The counters then go back to zero at midnight UTC, on Monday at midnight UTC, or on the first of the month at midnight UTC. Without it the limits cover the key’s whole life. The name and the clock are OpenRouter’s. A child does not inherit its parent’slimit_reset, and a child’s reset never lifts a limit above it: its use counts against each key above it in that key’s own period. - Change
max_requests,max_tokens,limitorlimit_reseton a live key withPATCH /v1/keys/{key_id}. See Update or switch off a key. - Read what is left before a call is rejected. See Read a key and its usage.
A key with max_tokens or limit, or with a parent that has one, must send an output token limit on every model request (max_tokens, max_completion_tokens, or max_output_tokens, by format). Without one the request gets a 400. Token and request limits explains how both limits are counted.
Restrict a key to some models
allowed_models takes model IDs as GET /v1/models lists them, or <provider>/<model> to allow one model on one provider only. A call to a model outside the list gets a 403, and GET /v1/models shows that key only the models it may call. allowed_providers and allowed_sandbox_providers do the same for providers. Model and provider allowlists says how IDs match and how the lists hold child keys.
Not on the hosted beta yet: until its next update this body has the message model is not permitted by this api key, param null and code forbidden.
Expiry
Set expires_at on any key that should end on its own, such as a key you pass into a sandbox or hand to a contractor’s CI job. After that time the key gets a 401 api key has expired. An expired key cannot be extended. Create a new one.
List keys
The list covers every project in the account, oldest first. Query parameters: limit (default 50, at most 200), cursor (pass next_cursor from the last page), include_revoked and include_expired (both default true).
The list never shows a secret. has_more says whether another page follows. parent_key_id on a key names the key that created it.
Read a key and its usage
Three calls return a key with its limits and how much of them is used: GET /v1/keys (every key), GET /v1/keys/{key_id} (one key), and GET /v1/key (the key that makes the call). The first two need the admin scope. GET /v1/key works with any key, whatever its scopes, so a key you passed into a sandbox or an agent can check its own budget. OpenRouter has the same call.
That key had made two model calls. The response is a key object:
The counters cover the current period only. For use over time, read Usage and cost.
Update or switch off a key
PATCH /v1/keys/{key_id} changes a key’s name, max_requests, max_tokens, max_sandboxes, limit, limit_action, limit_reset and disabled, and its allowed_models, allowed_providers and allowed_sandbox_providers (not on the hosted beta yet). Only the fields you send change. Send null to clear a name, a limit, the reset or a list.
The rules. Each was run on the hosted beta:
- A new limit cannot be higher than the limit of the key that created this key. That returns 403 with
error.codekey_grant_exceeds_parentand the messagemax_tokens cannot be higher than the limit of the key that minted this key. - The usage counters do not change. A limit set below what is already used rejects the next call.
"disabled": trueswitches the key off without deleting anything. Every call with it, or with a key created from it at any depth, returns 401api key is disableduntil you send"disabled": false. It returns 409 witherror.codelast_admin_keywhen it would leave the account with no usable admin key.- Scopes,
expires_atand the project cannot be changed. Sending one returns 400unknown field in key update request. Create a new key for those. - A new list must stay inside the lists of the keys above this key and of the calling key, so a key cannot widen itself. That returns 403
key_grant_exceeds_parent. See Model and provider allowlists. - A revoked key cannot be updated. That returns 409
api key has been revoked and cannot be updated.
Rotate a key
POST /v1/keys/{key_id}/rotate gives a key a new secret. The key ID stays the same, and so do its project, scopes, limits, counters, expires_at and the keys created from it. Usage records keep the same key_id, so cost by key is unbroken. It needs the admin scope.
grace_period_seconds keeps the old secret working while you deploy the new one. The most is 604800, 7 days. Leave it out and the old secret stops at once.
The response above is cut to the fields that matter here and was not captured live. secret is shown once. previous_secret_expires_at says when the old secret stops. It is null on a key that has one secret.
What to know:
- Both secrets are the same key. They count against the same limits, and a key that is revoked, switched off or expired is rejected through either one.
- A key keeps one old secret. If you rotate again inside the grace period, the earlier old secret stops at once.
- The grace period never runs past the key’s
expires_at. Rotation does not moveexpires_at. - The route does not take
Idempotency-Key. If you lose the response, rotate again. With a grace period the secret you still hold keeps working until you have the new one. With no grace period, rotate with another admin key. - An admin key may rotate itself. With no grace period, that response is the last one its old secret reads.
- Each rotation is in the audit log as
api_key.rotated. The entry never holds a secret.
To stop a key for good, revoke it instead.
Revoke a key
DELETE /v1/keys/{key_id} revokes a key at once and returns 204. Calling it again also returns 204. A revoked key stays in the list with revoked_at set.
Revoking a key revokes every key created from it, at any depth: the keys it created, the keys those created, and so on. parent_key_id on a key shows the tree, so list keys and read it before you revoke a key that created others. In a run on the hosted beta, a call with a child key returned 401 api key has been revoked right after its parent was revoked, and the child showed revoked_at in the list. Before 2026-11-24 the children stayed alive. A child that was live under a parent revoked before then is still live: revoke it by its own ID.
To stop a key for a while without revoking it, switch it off: see Update or switch off a key.
Two cases return 409 with error.code last_admin_key instead of revoking:
- The key and the keys created from it hold every admin key of the account that is neither revoked nor expired. Create another admin key from a key that stays first.
- For
DELETE /v1/projects/{project_id}: the project holds every such admin key, or a limited key in it has a live child in another project. See Projects.
Lost keys
Meadow cannot show a secret again. If you lose a working key, create a new one with an admin key. If you lose every admin key, write to your Meadow contact: only Meadow can issue a new admin key for an account.
People in the dashboard
The Meadow dashboard signs people in and calls the API with the person’s session, not with a key. Not on the hosted beta yet. Each person has one role in the account: owner, admin, member or viewer (Read-only). A member sees and manages only the keys they created, and never creates an admin key. Model calls, sandbox creates and work inside a sandbox always need a key, so every dollar is charged to a key. A person may read GET /v1/models, GET /v1/sandboxes and GET /v1/images without x-meadow-project: the model list then covers every verified provider key of the account, and the two lists cover every project, each row naming its project_id. Your code keeps using keys, and nothing here changes for it. An owner or admin can restrict a project so a member or viewer sees it only after being added: see Restricted projects.
People ask for access on the Meadow website, which sends the form to createAccessRequest. It needs no key and no session. Meadow’s operators approve requests by hand. An owner invites people by email and sets their role. The invite page reads the invite from its link with getInviteLink, which also needs no credential and shows only the account name, the role, a masked address and the expiry. An invite lasts 7 days and is used once. The invited person signs in with that address, verified, and accepts the invite on its page with acceptInvite; signing in alone joins nothing. Every account keeps at least one owner. Removing a person revokes the keys they minted. A lower role revokes the keys the new role could not mint: admin keys below admin, every key for a viewer. A member or viewer also loses the keys they minted in a restricted project they can no longer see: when the project is restricted, when they are removed from its members, and when their role drops to member or viewer.
Operations for people: getMe, getMyPreferences, putMyPreferences, listMembers, updateMember, removeMember, listInvites, createInvite, revokeInvite, acceptInvite.
API reference
Operations on this page: createKey, listKeys, getCurrentKey, getKey, updateKey, revokeKey, rotateKey, listProjects.