Management APIs/API Keys

Create API Key

POST

Overview

Create a new API key for the authenticated account. The plaintext api_key is returned only once in the creation response, so store it immediately.

Authentication

All API requests require a Bearer token in the request header.

Authorization: Bearer YOUR_API_KEY

Create and manage API keys from API Keys or use https://www.apimall.ai/api-keys.

Request

API Information

  • URL: POST https://gateway.apimall.ai/api/v1/keys
  • Content-Type: application/json

Request Parameters

ParameterTypeRequiredDescription
title
stringRequired

Human-readable API key label.

Request Example

{
  "title": "Production backend"
}

Response Example

{
  "success": true,
  "data": {
    "id": 13,
    "title": "Production backend",
    "status": "created",
    "created_at": "2026-03-12T09:50:00.000Z",
    "api_key": "sk-0123456789abcdef0123456789abcdef0123456789abcdef"
  },
  "request_id": "req_01HQ9M7J7X9P7Y8T6W5V4U3S2R"
}

cURL Example

curl --request POST 'https://gateway.apimall.ai/api/v1/keys' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "Production backend"
}'

JavaScript Example

const API_KEY = process.env.APIMALL_API_KEY;

const payload = {
  "title": "Production backend"
};

const response = await fetch('https://gateway.apimall.ai/api/v1/keys', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(payload),
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}

const data = await response.json();
console.log(data);

Response Parameters

ParameterTypeDescription
success
boolean

Whether the request completed successfully.

data.id
integer

id field returned by the API.

data.title
string

title field returned by the API.

data.status
string

Current status value returned by the API. Generation task endpoints use normalized values such as `pending`, `processing`, `completed`, `failed`, or `unknown`; management endpoints may return resource states such as `created`, `revoked`, or `active`.

data.created_at
string

Creation timestamp for the returned resource or task record.

data.api_key
string

Plaintext API key. Returned only once when the key is created.

request_id
string

Request identifier for debugging and support.

Error Response Example

{
  "success": false,
  "error": {
    "code": "invalid_request",
    "message": "Invalid title"
  },
  "request_id": "req_01HQ9M7J7X9P7Y8T6W5V4U3S2R"
}

Integration Notes

  • Store your API key on the server side only.

Error Codes

Common Error Codes

Status CodeDescription
200Request successful
400Invalid request parameters
401API key required or invalid API key
403API access not approved or request made on a non-gateway host
429Rate limit exceeded or too many concurrent jobs
500Internal server error
Create API Key - API Reference | API Mall | API Mall