Quick Start
Start with User Access or Application Access, obtain a token, and verify your first API request.
Make your first authenticated request using the access model that matches your integration.
API base URL
Data region: Europe
https://api.elecq.comChoose your access model
| Scenario | Start here | Credentials |
|---|---|---|
| Access a user's devices with their authorization | User Access | A User Access client ID, secret, and registered callback URL. |
| Import devices assigned to your organization from your backend | Application Access | A dedicated Application Access client ID and secret, plus a registered recipient RSA public key supplied as a PEM file. No user login or callback URL. |
Use separate client IDs for these two modes. Scopes and token lifetimes are configured independently. Both use the same Token endpoint.
User Access
1. Prepare your integration
Before making requests, obtain a client_id and client_secret from your ELECQ integration contact. Register your application’s callback URL and confirm the scopes available to your client.
The user must complete the authorization and consent flow before your application can access their resources. Follow the Authentication Guide for the authorization URL, callback handling, and complete cURL examples.
2. Obtain an access token
- Send the user through
GET /api/v1/oauth2/authorize. - Receive the authorization
codeat your registered callback and verify the returnedstate. - Call Obtain / Refresh Tokens with
grant_type=authorization_code,code, and the sameredirect_uri. - Authenticate that Token request using HTTP Basic: your client ID as the username and client secret as the password.
Use the returned access_token for the following request. Store a refresh token if one is issued.
3. Make your first API call
The Hello Test endpoint checks connectivity and authentication without requiring device parameters.
curl --request GET 'https://api.elecq.com/api/v1/access/hello' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'Replace YOUR_ACCESS_TOKEN with the value returned by the Token endpoint. A successful call returns HTTP 200 OK with Hello in the response body.
Try it in this documentation
- Open Hello Test.
- Enter the access token value in the Bearer credential field.
- Click Try It! and inspect the response.
The API Reference adds the Bearer header for you. You can also copy its generated request into your own integration.
4. Find the user’s devices
Call List Devices with the same Bearer access token. Use a returned deviceId when calling Device Details or other device-specific endpoints.
Access depends on the scopes granted to your client and the authorizing user’s permissions.
5. Keep your access token current
Use the token response’s expires_in value to plan refreshes. The same Token endpoint accepts grant_type=refresh_token and your latest refresh token, using HTTP Basic authentication.
If a replacement refresh token is returned, use it for subsequent refreshes. See the Authentication Guide for refresh examples and common authentication errors.
Application Access
1. Prepare your application and recipient key
Obtain the dedicated Application Access client ID and secret from ELECQ. Confirm application.device.read is enabled. Reading PINs or Random Codes additionally requires application.device.credentials.read.
Generate an RSA key pair and provide ELECQ with the PEM public key file, identifying the client ID to which it belongs. Keep the private key on your backend. Follow Business Data Encryption for the public key requirements. Wait for ELECQ to confirm activation and provide the key identifier (kid); associate it with the matching private key before requesting device pages.
2. Obtain an application token
Use Client Credentials. Explicitly send the required scopes; omitting scope grants no resource API permissions.
curl --request POST 'https://api.elecq.com/api/v1/oauth2/token' \
--user 'APPLICATION_CLIENT_ID:CLIENT_SECRET' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=application.device.read application.device.credentials.read'The response is ordinary JSON with access_token, token_type, expires_in, and the granted scope. This grant returns no refresh token or ID token. Confirm that the scopes you need were granted, and cache the access token on your backend.
3. Request and decrypt the first page
Call List Organization Devices. Omit the cursor and time filters for a complete organization reconciliation. This example requests one device per page to simplify initial verification.
curl --get 'https://api.elecq.com/api/v1/access/organization/devices' \
--header 'Authorization: Bearer APPLICATION_ACCESS_TOKEN' \
--header 'Accept: application/jose' \
--data-urlencode 'limit=1' \
--data-urlencode 'fields=deviceId,productModel,pin,randomCode,importedAt'Verify HTTP 200, Content-Type: application/jose, and Cache-Control: no-store. Decrypt the raw JWE Compact response using the private key matching its kid, verify its authentication tag, then parse the page JSON. Every successful page is encrypted, even when only basic fields are requested. The plaintext contains items, nextCursor, and hasMore.
4. Store each page and continue
Upsert records by deviceId (the device SN), preserving PINs and Random Codes as strings. Store the page before saving its next cursor. While hasMore is true, send nextCursor unchanged with the same limit, fields, and time filters. Stop only when hasMore is false and nextCursor is null. See the continuation example.
For normal imports, choose a limit from 1 to 500 (default 200). A cursor run has a fixed 24-hour lifetime by default and does not freeze the device list. Process duplicates idempotently and start periodic full reconciliations without a cursor.
5. Renew tokens and handle errors
Reuse the token until shortly before its reported expiry, then repeat the client-credentials request with the same required scopes. A new token for the same client and organization can continue a valid cursor. No browser authorization or refresh-token grant is needed.
Check HTTP status and Content-Type before decryption. API-generated errors are JSON; gateway responses may differ. On 403, check scopes and key registration. For persistent 503 responses, contact ELECQ with the client ID, UTC request time, and error code; obtaining more tokens does not resolve a service failure. Follow the device-list error handling for retry and recovery rules.
Updated 18 days ago
