POST /admin/api-keys

Create a new API key for a customer. The API key is only shown once in the response - save it securely!

application/json

Body Required

  • customer_name string Required

    Customer/company name

  • customer_email string

    Contact email (optional)

  • max_devices integer

    Maximum devices this key can create

    Default value is 5.

  • rate_limit_per_hour integer

    API rate limit per hour

    Default value is 1000.

Responses

  • 201 application/json

    API key created successfully

    Hide response attributes Show response attributes object
    • status boolean
    • code integer
    • message string
    • data object
      Hide data attributes Show data attributes object
      • id integer
      • api_key string

        Save this! Only shown once

      • customer_name string
      • max_devices integer
      • rate_limit_per_hour integer
  • 401 application/json

    Unauthorized - Invalid admin secret

    Hide response attributes Show response attributes object
    • status boolean
    • code integer
    • message string
    • error string
POST /admin/api-keys
curl \
 --request POST 'http://localhost:7001/admin/api-keys' \
 --header "X-Admin-Secret: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"customer_name":"Acme Corp","customer_email":"admin@acme.com","max_devices":10,"rate_limit_per_hour":5000}'
Request examples
{
  "customer_name": "Acme Corp",
  "customer_email": "admin@acme.com",
  "max_devices": 10,
  "rate_limit_per_hour": 5000
}
Response examples (201)
{
  "status": true,
  "code": 201,
  "message": "API key created successfully",
  "data": {
    "id": 1,
    "api_key": "ak_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "customer_name": "Acme Corp",
    "max_devices": 10,
    "rate_limit_per_hour": 1000
  }
}
Response examples (401)
{
  "status": false,
  "code": 400,
  "message": "Bad request",
  "error": "Bad request"
}