Developers

Search the docs

Search guides and headings.

Authentication

Send your API key in the X-Partner-API-Key header, store it safely, and roll or revoke it without downtime.

View as Markdown

You will authenticate every call with an API key, store it safely, roll it without downtime, and check what it can do.

The header#

Send the key in X-Partner-API-Key on every call to https://api.dev.nurishd.ca.

bash
curl https://api.dev.nurishd.ca/developer/v1/key/get/document \
  -H "X-Partner-API-Key: $NURISHD_API_KEY"

There is no other way to authenticate. Do not send the key in a query string.

Key anatomy#

A key is a prefix followed by 64 hex characters.

text
nk-test-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
nk-prod-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
PrefixEnvironment
nk-test-Sandbox
nk-prod-Production

The prefix decides where the call goes. Both reach https://api.dev.nurishd.ca.

  • The console shows the full key once, when you create it. Nurish'd does not keep it in a form it can show you again. If you lose it, create a new key.
  • A key that fails for any reason (missing, malformed, unknown, revoked or expired) answers 401 invalid_api_key. The answers are identical on purpose.
  • A key with no narrowed scopes follows the company's scopes. A key can never hold a scope the company lacks. See Scopes.
  • No key can be created until the company owner accepts the API terms. Production keys need a company that Nurish'd marked Live.

Store keys safely#

  • Read keys from environment variables or a secret manager. Never commit them.
  • Never ship a key in a browser, a mobile app or a public repository. Call the API from your server.
  • Use one key per service so you can revoke one without stopping the others.
  • Narrow a key to the scopes its job needs. A reporting job should not hold write scopes.
  • Never put a key in a log line, a support email or an AI prompt.

If a key leaks, revoke it in the console at once. A revoked key answers 401 invalid_api_key.

Check a key#

GET /developer/v1/key/get/document returns the key you call it with: its name, mode, the scopes it holds now, your company (company_id, company_name and company_status) and the calls per minute it may make (rate_limit_per_minute). It needs no scope.

json
{
	"key_id": "key-0001",
	"name": "Order service",
	"mode": "test",
	"scopes": ["catalog:read", "order:read", "order:write"],
	"company_id": "company-0001",
	"company_name": "Example Foods",
	"company_status": "Sandbox",
	"rate_limit_per_minute": 25
}

Use it in a deploy check to confirm the key works and has the access you expect.

Roll a key without downtime#

Rolling makes a new key and sets the old one to expire after a window you choose: now, 1 hour, 1 day or 7 days.

  1. Roll the key in the console and pick a window long enough to deploy, such as 1 day.
  2. Copy the new key. It is shown once.
  3. Deploy the new key to every service.
  4. Check each service with GET /developer/v1/key/get/document.
  5. The old key stops working when its window ends. Choose "now" only if the old key leaked.

See Managing keys for who can roll keys in each environment.

Revoke a key#

Revoke a key in the console when a service is retired or a key may have leaked. A revoked key cannot be restored. Create a new key instead. Removing a member does not revoke the keys they made, because keys belong to the company.

Next#

  • Scopes: what a key may do.
  • Managing keys: create, roll and revoke in the console.
  • Errors: invalid_api_key, scope_not_granted and the rest.