How to authenticate API requests
When to use this guide
Use this guide whenever you need to call any Elimapi API. First, choose one of the two authentication methods:
| Method | When to use |
|---|---|
| Access Token (JWT) | Applications with a user interface that require periodic login |
| API Key | Server-to-server automation, no session management needed |
Full reference (endpoints, error codes, quotas): Authentication reference
Prerequisites
- An activated Elimapi account — see Register an account
- Base URL:
https://openapi.elim.asia
Method 1: Access Token (JWT)
Step 1 — Log in to get a token
Send a POST request to the login endpoint:
POST /v1/auth/login
Content-Type: application/json
Accept: application/json
{
"email": "[email protected]",
"password": "password"
}
The response returns an access_token along with a refresh_token.
Step 2 — Attach the token to every request
Authorization: Bearer {access_token}
Accept: application/json
Content-Type: application/json
Important notes:
- The token is valid for 90 days.
- Cache the token (Redis/Memcached) to optimize performance.
- Never share the token with third parties.
Method 2: API Key
Step 1 — Create an API Key on the Dashboard
- On the Dashboard, enter a memorable name (e.g.
Production Server) and click Generate. - The system shows the full key only once — save it immediately.
- Manage your keys: view creation date and last use, or Revoke immediately if a key is leaked.
[!IMPORTANT] Security: An API Key has the same access rights as your account. Never share it on public platforms (GitHub, forums) or with untrusted third parties.
Step 2 — Send the key in the x-api-key header
Add the x-api-key header to every request:
curl -X POST "https://openapi.elim.asia/v1/products/search" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"q": "keyword", "platform": "taobao"}'
Verify the result
Send a test search request; a 200 response with product data means authentication succeeded:
curl -X POST "https://openapi.elim.asia/v1/products/search" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "áo thun", "platform": "taobao"}'
Common errors
| Error | Cause | How to handle |
|---|---|---|
| 401 | Token/API Key missing, wrong, or expired | Check the Authorization or x-api-key header |
| 403 | Account locked or insufficient permissions | Check account status on the Dashboard |
| 429 | Rate limit exceeded | Reduce call frequency or upgrade your plan |
Code examples (using API Key)
JavaScript (Axios)
const axios = require('axios')
const client = axios.create({
baseURL: 'https://openapi.elim.asia/v1',
headers: {
'x-api-key': 'YOUR_API_KEY_HERE',
'Content-Type': 'application/json',
},
})
async function searchProduct(keyword) {
try {
const response = await client.post('/products/search', { q: keyword, platform: 'taobao' })
console.log(response.data)
} catch (error) {
console.error('Error:', error.response.status)
}
}
Python (Requests)
import requests
API_URL = "https://openapi.elim.asia/v1/products/search"
HEADERS = {
"x-api-key": "YOUR_API_KEY_HERE",
"Content-Type": "application/json"
}
def search_product(keyword):
response = requests.post(API_URL, headers=HEADERS, json={"q": keyword, "platform": "taobao"})
if response.status_code == 200:
return response.json()
return None
Related links
- Reference: Authentication reference — endpoints, quotas, full error table
- Next: Searching for products · Creating & managing orders
- Configuration: Configuration reference