Skip to content

ESPAD AI API

Connect your own website, app or tools to the ESPAD AI assistants. The API is part of the Business plan and follows exactly the same safety rules as the site.

Overview

  • Base address: https://espad.ai/api/v1
  • Every request and answer is JSON over HTTPS. Send Content-Type: application/json with a body.
  • The version is in the address (v1). Changes that could break your code only come in a new version; new fields can be added to v1 at any time, so ignore fields you do not know.
  • Every answer has a request_id (also in the X-Request-Id header). Send it to us when you ask for help.
  • Answers are in English by default. For answers in another language, send "locale": "fa".

Authentication

Make a key in your panel under API keys. Only accounts on the Business plan can make keys, and each account can have up to 10 active keys. The full key is shown once; we keep only a fingerprint of it, so we cannot show it again.

Send the key in the Authorization header:

HTTP
Authorization: Bearer espad_sk_...
  • Use keys from your server only. Never put a key in a web page or a mobile app: the API does not answer browsers from other sites.
  • Give each system its own key, so you can revoke one without stopping the others.
  • If a key may have leaked, revoke it in the panel. It stops working at once.
  • If the Business plan ends, its keys stop working until the plan is active again.

Credits and limits

API requests use the same monthly credits as the rest of your plan; there is no separate API price. Each answer says how many credits it used in usage.credits and in the X-Credits-Used header. GET /me shows what is left. Credits renew on the 1st of each month (Los Angeles time).

Fixed safety answers (for example emergency guidance) use no credits. Writing posts and checking texts also count toward the monthly post allowance, like on the site.

LimitValue
Requests per key per minute60
Requests per key per day10,000
Requests per account per minute (all keys)120

Every answer has X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds). Over a limit you get 429 with a Retry-After header: wait that many seconds and try again.

Safety rules

  • The assistants follow exactly the same rules through the API as on the site. Emergency messages get fixed emergency guidance, and ESPADLIFE never gives doses, diagnoses or test-result readings.
  • An answer that breaks a brand rule is replaced by a safe answer. safety.stopped then tells you which side was stopped (input or answer) and the reason category.
  • Risk flags are hints for a person to review, never an approval. A person should read every text before it is published.
  • The API never publishes, sends messages or spends money. It only returns drafts and answers.
  • Do not send passwords, card numbers or other people’s health details.

GET /me

Your account, plan, credits, post allowance and limits.

cURL
curl https://espad.ai/api/v1/me \
  -H "Authorization: Bearer $ESPAD_API_KEY"
JSON
{
  "account": {
    "name": "Sara",
    "company": "Sara Beauty",
    "plan": "business"
  },
  "key": {
    "id": 12,
    "name": "Shop website",
    "prefix": "espad_sk_4fQ9"
  },
  "credits": {
    "used": 1240,
    "limit": 15000,
    "remaining": 13760,
    "resets_at": "2026-12-01T00:00:00.000Z"
  },
  "posts": {
    "used": 31,
    "limit": 1000,
    "remaining": 969
  },
  "rate_limits": {
    "per_minute": 60,
    "per_day": 10000,
    "account_per_minute": 120
  },
  "usage": {
    "credits": 0
  },
  "request_id": "req_..."
}

GET /assistants

The brand assistants you can chat with, and the id to use for each.

JSON
{
  "data": [
    {
      "id": "espadsell",
      "brand": "ESPADSELL",
      "name": "Sefaro",
      "role": "Sales coach",
      "chat": "/api/v1/assistants/espadsell/chat"
    },
    {
      "id": "espadcare",
      "brand": "ESPADCARE",
      "name": "Ziba",
      "role": "Beauty and style advisor",
      "chat": "/api/v1/assistants/espadcare/chat"
    }
  ]
}

POST /assistants/{id}/chat

One answer from an assistant. Your system keeps the conversation and sends the last turns each time; we do not store what is typed.

FieldTypeDescription
messagesarray, required1 to 12 turns of {"role": "user" or "assistant", "text": "..."}. The last turn must be the user, at most 800 characters.
localestring"en" or "fa". Default "en".
product_idnumberESPADHAND only: the id of a shop piece the question is about.
cURL
curl https://espad.ai/api/v1/assistants/espadcare/chat \
  -H "Authorization: Bearer $ESPAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","text":"A simple morning routine for dry skin?"}]}'
JSON
{
  "assistant": "espadcare",
  "reply": "Start with a gentle cleanser ...",
  "suggestions": [
    "What about the evening?"
  ],
  "safety": {
    "emergency": false,
    "stopped": null
  },
  "usage": {
    "credits": 3
  },
  "request_id": "req_..."
}

POST /posts

ESPADSELL post drafts in your account’s voice, each with risk flags. Saved to your History like drafts written on the site. Nothing is published.

FieldTypeDescription
kindstring, requiredcaption · follow_up · objection
platformstring, requiredinstagram · facebook · tiktok · whatsapp · linkedin
briefstringYour notes, up to 2,000 characters.
objectionstringprice · think · mlm · have_one · time · partner
variantsnumber1 to 3. Default 1.
qualitystring"standard" or "best". "best" uses more credits.
product_idnumberOne of your products (GET /products). Only its approved claims are used.
cURL
curl https://espad.ai/api/v1/posts \
  -H "Authorization: Bearer $ESPAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind":"caption","platform":"instagram","variants":2,"product_id":41,"brief":"New autumn set"}'
JSON
{
  "id": 9812,
  "kind": "caption",
  "platform": "instagram",
  "product_id": 41,
  "variants": [
    {
      "angle": "...",
      "headline": "...",
      "text": "...",
      "flags": [
        {
          "phrase": "...",
          "category": "health",
          "reason": "...",
          "safer_wording": "..."
        }
      ]
    }
  ],
  "left_out": [],
  "usage": {
    "credits": 6
  },
  "request_id": "req_..."
}

POST /checks

Checks your own text for risky claims and suggests a safer version.

FieldTypeDescription
textstring, required3 to 4,000 characters.
qualitystring"standard" or "best".
product_idnumberOne of your products, so its approved claims stay allowed.
JSON
{
  "id": 9813,
  "product_id": null,
  "flags": [
    {
      "phrase": "cures acne",
      "category": "health",
      "reason": "...",
      "safer_wording": "..."
    }
  ],
  "summary": "...",
  "safer_version": "...",
  "usage": {
    "credits": 4
  },
  "request_id": "req_..."
}

GET /products

Your products with their approved and forbidden claims, for product_id.

Errors

Errors use normal HTTP status codes and always the same JSON shape:

JSON
{
  "error": {
    "type": "invalid_request",
    "message": "\"platform\" must be one of: ...",
    "param": "platform"
  },
  "request_id": "req_..."
}
StatusTypeMeaning
401unauthorizedThe key is missing, wrong or revoked.
403plan_requiredThe account is not on the Business plan.
404not_foundNo such endpoint, assistant or product.
413too_largeThe body is too large.
422invalid_requestA field is missing or wrong; param names it.
402credits_exhaustedThis month’s credits are used up.
402monthly_limitThis month’s post allowance is used up.
429rate_limitedToo many requests; wait Retry-After seconds.
500server_errorSomething failed on our side; try again.
503pausedThe API is paused for maintenance.

Logs and privacy

  • For each request we keep the endpoint, the status, the credits and the time for 90 days, so you can see them in your panel. We never keep chat messages.
  • Posts and checks are saved to your History, like on the site, and you can delete them there.
  • Key changes (made, revoked) are kept in the same log.

Questions about the API? Contact us