Skip to main content
Elimapi

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:

MethodWhen to use
Access Token (JWT)Applications with a user interface that require periodic login
API KeyServer-to-server automation, no session management needed

Full reference (endpoints, error codes, quotas): Authentication reference

Prerequisites

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

  1. On the Dashboard, enter a memorable name (e.g. Production Server) and click Generate.
  2. The system shows the full key only once — save it immediately.
  3. 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

ErrorCauseHow to handle
401Token/API Key missing, wrong, or expiredCheck the Authorization or x-api-key header
403Account locked or insufficient permissionsCheck account status on the Dashboard
429Rate limit exceededReduce 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