Skip to Content
API and MCPResources

Managing FieldCamp API keys: create, scope, and rotate

Create, scope, rotate, and revoke FieldCamp API keys with /api/v1/api-keys to give every integration its own credentials.

FieldCamp API keys are the credentials your integrations, scripts, and partner apps use to call the platform on your behalf. The /api/v1/api-keys endpoints let you list, create, retrieve, update, and delete personal-access-style keys — each with its own scopes, expiry, and rate-limit overrides — so every integration gets a credential matched to exactly what it needs to do.

This guide walks dispatchers, owners, and developers through the day-to-day operations of API key management: minting a new key for a new integration, narrowing its scopes, setting expiry dates, rotating compromised keys, and revoking access cleanly when a vendor or team member moves on. If you are still issuing a single shared key, this is the workflow that gets you to a safer per-integration setup. For a broader tour of every endpoint and resource, start with the API reference overview.

Two kinds of key: personal and scoped

Every key has a type, fixed when it is created.

  • personal (the default) acts as the person who created it. On /api/v1 it holds every scope, so its scopes list does not limit it. A personal key created by an account owner or admin can also list, create, update and delete other keys.
  • scoped can do only what its scopes list allows, and only on /api/v1. It cannot manage keys at all.

To limit what an integration can touch, send "type": "scoped" when you create its key. Treat a personal key as an account-level credential: do not hand one to a third party, and do not embed any key in something a customer can read.

What API keys are for

API keys identify the calling app and authorize the actions it can take. See Authentication for how to send one. Each key has its own rate limit, 60 requests per minute by default. Each key is owned by your company and can be assigned to a specific integration — a website booking widget, a QuickBooks sync, a custom dashboard, or an internal automation built with the workflow automation engine.

With scoped keys, a read-only reporting tool never has the same powers as a job-creation worker. Smaller blast radius if a key leaks.

Plan your keys before you create them

A few minutes of planning saves cleanup later. For every integration, decide:

  • Owner — who in your team is responsible if it breaks
  • Scopes — the minimum set of resources it must read or write
  • Expiry — a hard end date for short-lived projects, or a rotation cadence (90 days is a common default) for long-lived ones
  • Rate limit — raise it only if the integration genuinely needs more than the default 60 requests per minute

Name keys after the integration, not the person — booking-widget-prod, quickbooks-sync, bi-dashboard-read. When someone leaves the company, you do not have to rename anything.

Create an API key

POST to /api/v1/api-keys

Send a POST request with a friendly name, "type": "scoped", the scopes array, and optional expiresAt, rateLimit and description fields. The response contains the full key string once — store it immediately in your secrets manager.

Save the secret

The plaintext key is only returned on creation. After that you only ever see the key's metadata (name, scopes, expiry, last used). If you lose it, rotate and re-issue.

Test with a low-risk call

Verify the key against a read endpoint it is scoped for — GET /api/v1/clients?limit=1 is the simplest — before wiring it into production. If you get a 401, double-check the headers per Authentication; a 403 means the key is missing that scope.

Deploy and monitor

Add the key to your integration's environment variables and ship. Watch the first few hours of requests for 429s — if you see them, revisit your rate-limit override or back-off logic.

Fields

FieldOn createOn updateDescription
nameRequiredYesUp to 100 characters.
typeOptionalNopersonal (default) or scoped. Cannot be changed later.
scopesRequired for a scoped keyYesA scoped key needs at least one. A scope that does not exist returns 422.
expiresAtOptionalNoAn ISO-8601 time in the future. Left out, the key never expires. Cannot be changed later.
rateLimitOptionalYesRequests per minute, a whole number from 1 to 6000. Default 60.
descriptionOptionalYesFree text.
environmentOptionalNolive (default) or test. On a sandbox account only test is accepted, so send it there; live returns 422. Cannot be changed later.
isActive—Yesfalse switches the key off without deleting it.

Only an account owner or admin can call these routes. Anyone else gets 403. A failed check returns 422 with one entry per field in error.details.

Scope keys to the minimum needed

Scopes bind only a key created with "type": "scoped".

Scopes let you grant only the resources an integration really uses. A reporting tool that reads jobs and visits does not need write access to clients or items. Common scope patterns:

  • Read-only analytics — jobs:read, visits:read, clients:read
  • Booking-widget intake — clients:write, jobs:write. Note that a :write scope includes delete.
  • Accounting sync — invoices:read, clients:read, plus webhooks:manage to manage webhooks
  • Full admin automation — a personal key, but only for trusted internal tools

If you are not sure which scopes a key needs, start narrow and widen based on the 403s you see. The error responses from FieldCamp explicitly tell you which scope was missing — see Errors for the response shape.

Set expiry and rotate keys regularly

Long-lived secrets are the riskiest secrets. Use the expiresAt field to put a hard ceiling on every key, then rotate before it expires.

Expiry is set at creation only

expiresAt is accepted on POST /api/v1/api-keys but is not part of the update contract, so a key's expiry cannot be changed later — plan it when you mint the key. A key created through the API without expiresAt never expires. A key created in the app under Settings → Developers gets the expiry chosen there: 30, 90 or 365 days, or never, with 90 days preselected.

Rotate in one call

POST /api/v1/api-keys/{id}/rotate replaces a key without downtime.

  • A new key is created with the same name, scopes, type, rate limit and expiry. Its value is returned once, in key.
  • The old key keeps working for a grace period so the integration can switch over. The default is 24 hours. Send { "graceSeconds": 3600 } to change it; the range is 0 (stop the old key now) to 604800 (7 days).
  • previousKey.expiresAt in the response says when the old key stops.
  • Webhook endpoints the old key created move to the new key.

Only an account owner or admin can rotate a key, and a scoped key cannot call this route.

curl -X POST https://api.fieldcamp.ai/api/v1/api-keys/$KEY_ID/rotate \
  -H "Authorization: Bearer $FIELDCAMP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "graceSeconds": 3600 }'

Rotate by hand

The same result, step by step:

Mint a new key alongside the old one

Create the replacement with the same scopes and a fresh expiry. Both keys are valid at this point.

Deploy the new key

Update the integration's environment, redeploy, and verify it is calling FieldCamp successfully. Use the idempotency patterns so re-running a deploy does not duplicate records.

Watch the old key go idle

Check lastUsedAt on the old key. Once it has not been used for a full day, you know nothing is still depending on it.

Delete the old key

DELETE /api/v1/api-keys/{id} removes it permanently. Any request carrying the old key now returns 401, and webhook endpoints that key created are paused. To switch a key off without removing it, send "isActive": false with PUT.

Never delete a key without confirming via lastUsedAt that nothing is still using it. Surprise revocations break production integrations and trigger angry calls from your dispatch team.

Override the default rate limit

Each key has its own limit; there is no shared account-wide limit. If one integration legitimately needs more headroom — say, a nightly batch import — set a higher rateLimit on just that key, from 1 to 6000 requests per minute, on create or with PUT /api/v1/api-keys/{id}. Giving each integration its own key means a runaway script cannot use up another integration's budget.

See Rate limits for the headers FieldCamp returns and a sample back-off strategy.

Rotate immediately if a key leaks

A leaked key is a live credential. If a developer pastes one in a public repo, a screenshot ends up in a support ticket, or a laptop is lost, treat it as compromised and rotate now.

Delete the leaked key

Hit DELETE /api/v1/api-keys/{id} first to stop the bleeding. The leaked credential is now dead.

Audit recent activity

Pull the last 24-48 hours of activity for that key. Look for unusual job creation, unexpected client updates, or any change you did not authorize — you can cross-reference with job logs and any webhook events that fired.

Issue a replacement

Create a new key with the same scopes (or narrower, if the leak proved scopes were too wide) and deploy it.

Update the secret store

Rotate the value in every place it was stored — secrets manager, CI variables, local .env files, deployment platform. Then invalidate any cached copies.

Audit and clean up keys quarterly

Run through your key list at least every quarter. GET /api/v1/api-keys returns every key on the account, including ones switched off (isActive: false), with its type, scopes, expiry, and last-used timestamp. For each key, ask:

  • Is the owning integration still running?
  • Are the scopes still the minimum it needs?
  • When was it last used? Anything dormant for 60+ days is a candidate for deletion.
  • Has it been rotated this calendar quarter?

Common pitfalls

  • Sharing one key across every integration. A leak takes everything down at once. Issue one per integration.
  • Embedding keys in client-side code. Browsers and mobile apps are public surfaces. Always proxy through your own backend.
  • Forgetting expiresAt. Keys without expiry quietly become forever-keys. Always set one.
  • Using a personal key where a scoped one would do. A personal key holds every scope. Create a scoped key with the narrowest set that works.
  • Not testing after rotation. Always hit a real endpoint with the new key before flipping production traffic.

If your team is new to working with the FieldCamp API, walk through the quickstart first, then come back to set up per-integration keys once you have one integration working end to end. You can also follow the API changelog so you know when new scopes or endpoints land.

Endpoints

GET/api/v1/api-keys

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/api-keys"
{  "success": true,  "message": "",  "data": null}
POST/api/v1/api-keys

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/api-keys" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "success": true,  "message": "",  "data": null}
GET/api/v1/api-keys/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/api-keys/665f1c2ab3e4d5f6a7b8c9d0"
{  "success": true,  "message": "",  "data": null}
PUT/api/v1/api-keys/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/api/v1/api-keys/665f1c2ab3e4d5f6a7b8c9d0"
{  "success": true,  "message": "",  "data": null}
DELETE/api/v1/api-keys/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/api/v1/api-keys/665f1c2ab3e4d5f6a7b8c9d0"
{  "success": true,  "message": "",  "data": null}
POST/api/v1/api-keys/{id}/rotate

Authorization

BearerAuth
AuthorizationBearer <token>

JWT from POST /api/auth/login (response.data.token). Tokens do not expire.

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/api-keys/string/rotate" \  -H "Content-Type: application/json" \  -d '{}'
{  "success": true,  "message": "",  "data": null}

On this page