Skip to main content
The EarthCoop API uses Bearer token authentication. Every protected endpoint expects a Bearer token in the Authorization request header. You receive this token after authenticating through the platform — no OAuth flow or separate API key setup is required.

How Authentication Works

When you log in, the platform issues a personal access token tied to your account. You include this token in subsequent API requests. Because tokens are user-scoped, any action performed via the API is attributed to your account — just as if you had performed it through the web interface.

Getting a Token

Option 1 — Web UI (recommended for testing): Log in to your EarthCoop account. If your deployment exposes a token management screen, you can create and name a personal access token there and copy it for use in API calls. Option 2 — Login endpoint: POST your credentials to the login endpoint. Verify the exact path with your administrator, as it may be customised per deployment:
A successful response returns your token in the token field:
Store this token securely — treat it like a password. It grants full access to your account’s resources.

Passing the Token

Include the token in the Authorization header on every authenticated request, prefixed with Bearer :
You must also set Accept: application/json so that the server returns JSON error responses instead of HTML redirects on authentication failure.

Example Authenticated Request

Which Endpoints Require Authentication

Token Expiration and Renewal

Tokens do not expire by default unless your administrator has configured a token expiry duration. If your token has expired, you will receive a 401 Unauthorized response:
When this happens, re-authenticate using the login endpoint to obtain a fresh token. Contact your administrator for the configured token lifetime if you are unsure.
Never commit tokens to source control or log them in application output. If a token is compromised, revoke it immediately through the web UI or by contacting your administrator.

Error Responses

Missing or invalid token — 401 Unauthorized:
Valid token, insufficient permission — 403 Forbidden: