Skip to main content

Login

Authenticate with an ECGrid username and password to obtain a JWT Bearer token for subsequent API calls.

Endpoint

POST /v2/auth/login

:::info No authentication required This endpoint does not require an X-API-Key or Authorization header — it is the entry point for obtaining credentials. :::

Request Body

FieldTypeRequiredConstraintsDescription
loginstringYesECGrid username or login identifier
passwordstringYesAccount password
{
"login": "jsmith@example.com",
"password": "Sup3r$ecret!"
}

Response

Returns a JWT Bearer token along with its expiry time and the authenticated user's ID.

{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": "2026-05-07T18:30:00Z",
"userId": 4821
},
"errorCode": "",
"message": ""
}
FieldTypeDescription
tokenstringJWT Bearer token — pass as Authorization: Bearer <token>
expiresAtdatetime (ISO 8601)UTC timestamp when the token expires
userIdintegerInternal ECGrid user ID for the authenticated account

:::tip Prefer API Key for server-to-server integrations JWT tokens expire and require refresh. For long-running services or automated pipelines, use the X-API-Key header with a key obtained from Generate API Key instead. :::

Code Examples

curl -X POST "https://rest.ecgrid.io/v2/auth/login" \
-H "X-API-Key: $ECGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "login": "jsmith@example.com", "password": "Sup3r$ecret!" }'

See Also