Skip to main content

Authentication

The GeoTareas API uses a dual-authentication model to secure every protected endpoint. Each request must include both a JWT token (representing user identity and permissions) and an API Key (representing your company integration). This layered approach ensures that both the user and the integration are independently validated on every call.


Authentication Flow

The following diagram illustrates the end-to-end authentication flow:

  1. Authenticate — Call POST /apidev/v1/login with your email and password.
  2. Receive a JWT — The server returns a signed token that expires 1 hour after issuance, by default.
  3. Attach credentials — Include the JWT, your API Key, and the tenant header on every subsequent request.
  4. Handle expiration — When you receive a 401, discard the token and re-authenticate. There is no refresh token flow.
Always send your assigned tenant

Every request — including login — must include the tenant header. The default tenant is geotareas.com; if your company was assigned a dedicated tenant, you must send that assigned value instead. A missing or wrong tenant is rejected with 401.


Login

MethodPOST
URL/apidev/v1/login

Headers

HeaderValueRequired
tenantYour assigned tenant domain (default: geotareas.com) — always send your assigned tenantYes
Content-Typeapplication/jsonYes

Request Body

FieldTypeRequiredDescription
emailstringYesThe user's email address.
passwordstringYesThe user's password.
playeridstringNoPush-notification player id to register for this user (max 200).

Code Examples

curl -X POST https://api.example.com/apidev/v1/login \
-H "tenant: $TENANT" \
-H "Content-Type: application/json" \
-d '{
"email": "dev@company.com",
"password": "your_password"
}'

Success Response

{
"success": true,
"data": {
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
},
"meta": {}
}

Error Responses

Invalid credentials

{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid email or password."
}
}

Missing tenant header

{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "The tenant header is required."
}
}

Expired token

A valid JWT that has passed its 1-hour lifetime returns TOKEN_EXPIRED (distinct from the UNAUTHORIZED code returned for wrong credentials):

{
"success": false,
"error": {
"code": "TOKEN_EXPIRED",
"message": "The token has expired. Log in again to obtain a new one."
}
}

Suspended company

If the company account is suspended by Logicsat (for example, for administrative reasons), the API returns 403 COMPANY_SUSPENDED on every endpoint, including login — no new tokens are issued and previously issued tokens stop working immediately. Integrations should treat this as a signal to stop retrying and contact Logicsat support:

{
"success": false,
"error": {
"code": "COMPANY_SUSPENDED",
"message": "The company account is suspended. Please contact Logicsat support."
}
}

Using the Token

Once authenticated, include these three headers on every API request:

HeaderValueDescription
tenantgeotareas.com (default)Your assigned tenant namespace — must be sent on every request.
AuthorizationBearer eyJhbG...The JWT obtained from login.
X-API-Keygtk_xxxxxxxxxxxxYour company integration key.

Example request:

curl -X GET "https://api.example.com/apidev/v1/fleet/devices?limit=25&offset=0" \
-H "tenant: $TENANT" \
-H "Authorization: Bearer $TOKEN" \
-H "X-API-Key: $APIKEY"

Token Lifecycle

PropertyDetail
Time-to-live (TTL)1 hour from issuance.
Refresh mechanismNone. Re-authenticate by calling the login endpoint when the token expires.
Expiration signalA 401 TOKEN_EXPIRED response indicates the token expired; a 401 UNAUTHORIZED indicates it is invalid.

When you receive a 401 response, discard the current token and perform a fresh login to obtain a new one. There is no refresh token flow -- simply call /apidev/v1/login again.


API Key Validation

The API Key is provided to your organization during onboarding. On every request, the server validates the following properties of your key:

CheckDescription
Tenant matchThe key must belong to the same tenant as the JWT.
ScopeThe key must have a valid integration scope assigned during onboarding.
StatusThe key must be in active status.
Time windowThe current time must fall within the key's valid_from and valid_until range.

If any of these checks fail, the server responds with 401 UNAUTHORIZED.


Security Best Practices

  • Store tokens securely. Keep JWTs in memory or secure storage. Never persist them in local storage on web clients.
  • Never expose API keys in client-side code. API keys should only be used in server-to-server communication or secure backend environments.
  • Rotate API keys periodically. Contact your account manager to schedule key rotation and minimize the window of exposure.
  • Always use HTTPS. All requests to the API must be made over TLS. Plain HTTP requests will be rejected.

Troubleshooting

SymptomCauseFix
401 — "Invalid email or password"Wrong credentialsVerify email and password. Passwords are case-sensitive.
401 — "The tenant header is required"Missing or empty tenant headerAdd the tenant header with your assigned domain.
401 after a period of working callsJWT expired (1 h TTL)Discard the token and call /apidev/v1/login again.
401 — API Key rejectedKey expired, inactive, or wrong tenantVerify the key status and validity window with your account manager.
429 — Too Many RequestsBrute-force protection triggered (5 failed logins in 30 s)Wait 60 seconds before retrying. Do not retry in a loop.