رفتن به محتوا
cloudhostمستندات
مرجع API

ایجنت

ساختن و تغییر برنامه با گفت‌وگو.

توضیح هر مسیر به انگلیسی است، همان متنی که مرجع از کد ساخته می‌شود. مسیرها، نام فیلدها و کدها همان‌اند که در درخواست می‌نویسید.
GET/v1/agent/config

Agent's limits and price#

Whether Agent is served, the limits of a message, a file and a voice message, and the price of one credit (one credit is one US cent of the work a run does).

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پاسخ

200AgentConfig

  • availableboolean
  • limitsobject
  • priceobject

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/agent/config" \
  -H "Authorization: Bearer $KEY"
GET/v1/agent/projects

Recent Agent projects#

The team's projects with an Agent conversation, the most recently active first, for the Agent home. A member limited to chosen projects sees only those.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • limitintegerکوئری

    1 to 100 (20)

پاسخ

200object

  • projectsAgentProjectSummary[]
    • idstring
    • namestring
    • titlestring
    • updated_atstring (date-time)
    • last_runobject

خطاها

وضعیتتوضیح
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/agent/projects" \
  -H "Authorization: Bearer $KEY"
POST/v1/agent/projects

Start Agent from a prompt#

The first message makes a new project named from the idea (or name), or, with project, goes to an existing project (deploy rights on it). Agent's key for the project and the place it works are made, and the message starts at once; follow it with the run's stream. A new project made for a start that then fails is removed again. Agent's own key is refused.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

بدنهٔ درخواستapplication/json

  • textstringالزامی

    the first message, 1 to 32,000 characters

  • namestring

    the new project's name (default a short name from the idea, made free with -2, -3…)

  • projectstring

    an existing project's name or id (default a new project)

  • attachmentsstring[]

    ids from POST /v1/agent/attachments (held) or, for an existing project, its own; at most 100 MB together

    0–10 items

  • linksstring[]

    web addresses for Agent to read itself, at most 10

    0–10 items

  • languagestring

    the language of the screen the message is sent from. Agent answers in the language of the message itself; this one is used when the message has none of its own (a name, code, a link, only files, "ok") and the conversation has none yet (default the person's saved language, else the request's Accept-Language, else fa)

    one of fa, en

  • voicestring

    the voice message (avj_…) the words came from, one of yours; the language it was spoken in counts when the words have none of their own

  • stand_in_textboolean

    true when text is the client's own stand-in for a message of only files or links; it then gives the message no language

پاسخ

201object

  • projectobject
  • conversationAgentConversation
  • runAgentRun

خطاها

وضعیتتوضیح
400Bad request: bad_text, bad_name, bad_attachment, bad_link, bad_language, bad_voice, bad_request, bad_json
401unauthorized: missing, invalid, expired or revoked credential
402No credit: insufficient_credit; Agent's monthly limit reached for the team or the project: agent_spend_cap
403Forbidden: forbidden, agent_blocked, agent_key
404Not found: not_found (no such project)
409Conflict: name_taken, agent_busy, agent_no_new_project (Agent cannot open a new project now: continue in an existing one, or contact support)
413Too large: too_large
500internal: an unexpected failure
503Unavailable: agent_unavailable, agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/agent/projects" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
POST/v1/agent/name

A project name from an idea#

A short name from the idea (lowercase letters, digits and hyphens, at most 30 characters), not taken in the team; the person can change it.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

بدنهٔ درخواستapplication/json

  • textstringالزامی

    the idea

پاسخ

200object

  • namestring

خطاها

وضعیتتوضیح
400Bad request: bad_text
401unauthorized: missing, invalid, expired or revoked credential
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/agent/name" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
POST/v1/agent/attachments

Attach a file before the project exists#

A file for the first message, held for the team for 24 hours until a start (POST /v1/agent/projects) names its id. The body and headers as for a project's attachment.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • content-sha256stringheaderالزامی

    the SHA-256 of the bytes, in hex; a different hash is refused and nothing is kept

  • content-lengthintegerheaderالزامی

    the size in bytes

  • x-file-namestringheaderالزامی

    the file's name, UTF-8, percent-encoded

بدنهٔ درخواستapplication/octet-stream

the file's bytes; its content-type is kept

string (binary)

پاسخ

201AgentAttachment

  • idstring

    aat_…

  • namestring
  • typestring
  • sizeinteger
  • kindstring

    one of file, voice

  • created_atstring (date-time)
  • heldboolean

    attached at the team level, before its project exists (POST /v1/agent/attachments); held 24 hours

خطاها

وضعیتتوضیح
400Bad request: bad_attachment, bad_hash
401unauthorized: missing, invalid, expired or revoked credential
411Length required: length_required
413Too large: too_large
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/agent/attachments" \
  -H "Authorization: Bearer $KEY" \
  --data-binary @file
DELETE/v1/agent/attachments/{attachment}

Remove a held file#

A held file, removed before it is used.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • attachmentstringمسیرالزامی

    the attachment's id (aat_…)

پاسخ

200object

  • idstring
  • deletedboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl -X DELETE "https://api.ibel.ai/v1/agent/attachments/attachment" \
  -H "Authorization: Bearer $KEY"
POST/v1/agent/voice

A voice message before the project exists#

A recorded voice message (at most 10 MB) turned into text for the Agent home's box, as a project's voice message.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • content-sha256stringheaderالزامی

    the SHA-256 of the bytes, in hex

  • content-lengthintegerheaderالزامی

    the size in bytes

  • asyncstringکوئری

    1: answer 202 at once with the job (AgentVoiceJob) and poll GET …/voice/{voice} for the text; without it the call waits for the text (up to a few minutes). Prefer: respond-async does the same.

    one of 1, true

بدنهٔ درخواستaudio/webm

the recording

string (binary)

پاسخ

200object

  • textstring
  • attachmentAgentAttachment
    • idstring

      aat_…

    • namestring
    • typestring
    • sizeinteger
    • kindstring

      one of file, voice

    • created_atstring (date-time)
    • heldboolean

      attached at the team level, before its project exists (POST /v1/agent/attachments); held 24 hours

202AgentVoiceJobAccepted (with ?async=1): the job, working; Location is its address

  • idstring

    avj_…

  • statusstring

    one of working, done, failed

  • textstring

    when done, the text for the box

  • errorobject

    when failed: {code, message}

  • attachmentAgentAttachment
  • formatstring

    the recording's format (webm, m4a, ogg, ...)

  • languagestring | null

    the language found in it (fa, en), once done

  • secondsnumber

    seconds since it was sent, or until it finished

  • accepted_snumber | null
  • created_atstring (date-time)
  • finished_atstring (date-time) | null

خطاها

وضعیتتوضیح
400Bad request: bad_audio, bad_hash
401unauthorized: missing, invalid, expired or revoked credential
402No credit: insufficient_credit
415Unsupported: bad_audio (a recording that cannot be read)
500internal: an unexpected failure
503Unavailable: voice_failed, agent_unavailable

نمونه

curl -X POST "https://api.ibel.ai/v1/agent/voice" \
  -H "Authorization: Bearer $KEY" \
  --data-binary @file
GET/v1/agent/voice/{voice}

A voice message's text, before the project exists#

A voice message sent with ?async=1: working until its text is ready (seconds to minutes), then done with text, or failed with error ({code, message}: voice_failed, bad_audio, ...). Ask again every 2 s or so; each ask is answered at once. Only the person who sent it sees it; kept a day.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • voicestringمسیرالزامی

    the voice message's job id (avj_…)

پاسخ

200AgentVoiceJob

  • idstring

    avj_…

  • statusstring

    one of working, done, failed

  • textstring

    when done, the text for the box

  • errorobject

    when failed: {code, message}

  • attachmentAgentAttachment
  • formatstring

    the recording's format (webm, m4a, ogg, ...)

  • languagestring | null

    the language found in it (fa, en), once done

  • secondsnumber

    seconds since it was sent, or until it finished

  • accepted_snumber | null
  • created_atstring (date-time)
  • finished_atstring (date-time) | null

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/agent/voice/voice" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/settings

Agent on a project#

Whether Agent holds a key for the project now, and since when. Agent is always available: the first message makes its key.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any

پاسخ

200AgentSettings

  • activeboolean

    Agent holds a key for the project now (it is always available; the first message makes the key)

  • sincestring (date-time)

    when the key in use was made

  • enabledboolean

    the same as active, kept for older clients

  • enabled_atstring (date-time)
  • enabled_bystring
  • keyobject

    Agent's key for this project (its secret is never shown)

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/settings" \
  -H "Authorization: Bearer $KEY"
PATCH/v1/projects/{project}/agent/settings

Make or stop Agent's key (older clients)#

Kept for older clients: Agent has no on or off switch (it is always available). false stops Agent on the project as POST …/agent/stop (its runs stop and its key is revoked at once); true makes its key now.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین

پارامترها

  • any

بدنهٔ درخواستapplication/json

  • enabledbooleanالزامی

پاسخ

200AgentSettings

  • activeboolean

    Agent holds a key for the project now (it is always available; the first message makes the key)

  • sincestring (date-time)

    when the key in use was made

  • enabledboolean

    the same as active, kept for older clients

  • enabled_atstring (date-time)
  • enabled_bystring
  • keyobject

    Agent's key for this project (its secret is never shown)

خطاها

وضعیتتوضیح
400Bad request: bad_setting
401unauthorized: missing, invalid, expired or revoked credential
403Forbidden: forbidden
404Not found: not_found
409Conflict: agent_no_new_project (Agent cannot open a new project now: continue in an existing one, or contact support)
500internal: an unexpected failure
503Unavailable: agent_unavailable (Agent cannot be reached right now), agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X PATCH "https://api.ibel.ai/v1/projects/my-api/agent/settings" \
  -H "Authorization: Bearer $KEY" \
  -d '{"enabled":true}'
GET/v1/projects/{project}/agent/conversations

Agent's conversations#

The project's conversation with Agent first, then its archived older ones (archived: true), readable.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • any
  • any

پاسخ

200object

  • conversationsAgentConversation[]
    • idstring

      acv_…

    • titlestring
    • archivedboolean

      an older conversation of the project, from before one conversation per project; readable, never continued

    • created_atstring (date-time)
    • updated_atstring (date-time)
    • created_bystring
    • last_runobject
  • next_cursorstring

خطاها

وضعیتتوضیح
400Bad request: bad_param, bad_cursor
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/conversations" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/conversations

Send a message (older clients)#

Kept for older clients: the project has one conversation, and this continues it, as POST …/agent/messages (the conversation is made on the first message). Follow the run with its stream. One message at a time per project. Needs credit in the wallet.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any

بدنهٔ درخواستapplication/json

  • textstringالزامی

    the person's message, 1 to 32,000 characters

  • attachmentsstring[]

    ids of attachments of this project (aat_…), at most 10 and 100 MB together; Agent sees images and PDFs as they are and reads the text of documents, recordings and videos

    0–10 items

  • linksstring[]

    web addresses (http or https, on the public internet) for Agent to read itself, at most 10; addresses written in text are read too

    0–10 items

  • languagestring

    the language of the screen the message is sent from. Agent answers in the language of the message itself; this one is used when the message has none of its own (a name, code, a link, only files, "ok") and the conversation has none yet (default the person's saved language, else the request's Accept-Language, else fa)

    one of fa, en

  • voicestring

    the voice message (avj_…) the words came from, one of yours; the language it was spoken in counts when the words have none of their own

  • stand_in_textboolean

    true when text is the client's own stand-in for a message of only files or links; it then gives the message no language

پاسخ

201object

  • conversationAgentConversation
    • idstring

      acv_…

    • titlestring
    • archivedboolean

      an older conversation of the project, from before one conversation per project; readable, never continued

    • created_atstring (date-time)
    • updated_atstring (date-time)
    • created_bystring
    • last_runobject
  • runAgentRun
    • idstring

      arn_…

    • conversationstring
    • statusstring

      waiting: for the person (a question or an approval)

      one of queued, running, waiting, completed, failed, stopped

    • textstring

      the person's message

    • attachmentsAgentAttachment[]
    • linksstring[]

      the web addresses the message gave, which Agent read itself

    • replystring
    • questionsAgentQuestion[]
    • approvalsAgentApproval[]
    • costobject
    • languagestring

      the language Agent writes back in for this message: the message's own; else the voice message's it came from; else the conversation's last; else the screen's (language on the message). A word to the running run in another language turns it. null on runs from before it was kept

      one of fa, en, null

    • created_bystring
    • created_atstring (date-time)
    • finished_atstring (date-time)
    • stepsAgentStep[]

      what the run changed in the project, in order

    • messagesobject[]

      what the person said to Agent while the run went

خطاها

وضعیتتوضیح
400Bad request: bad_text, bad_attachment (also a file no longer stored: attach it again), bad_link, bad_language, bad_voice, bad_request, bad_json
401unauthorized: missing, invalid, expired or revoked credential
402No credit: insufficient_credit
403Forbidden: agent_off, agent_blocked, forbidden
404Not found: not_found
409Conflict: agent_busy (the project's last message is still being worked on), agent_no_new_project (Agent cannot open a new project now: continue in an existing one, or contact support)
413Too large: too_large (the files are over 100 MB together)
500internal: an unexpected failure
503Unavailable: agent_unavailable (Agent cannot be reached right now), agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/conversations" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
GET/v1/projects/{project}/agent/conversations/{conversation}

One conversation#

The conversation and its runs, oldest first: each message, its files, Agent's reply, its questions and approvals, and its cost.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • conversationstringمسیرالزامی

    the conversation's id (acv_…)

پاسخ

200object

  • conversationAgentConversation
    • idstring

      acv_…

    • titlestring
    • archivedboolean

      an older conversation of the project, from before one conversation per project; readable, never continued

    • created_atstring (date-time)
    • updated_atstring (date-time)
    • created_bystring
    • last_runobject
  • runsAgentRun[]
    • idstring

      arn_…

    • conversationstring
    • statusstring

      waiting: for the person (a question or an approval)

      one of queued, running, waiting, completed, failed, stopped

    • textstring

      the person's message

    • attachmentsAgentAttachment[]
    • linksstring[]

      the web addresses the message gave, which Agent read itself

    • replystring
    • questionsAgentQuestion[]
    • approvalsAgentApproval[]
    • costobject
    • languagestring

      the language Agent writes back in for this message: the message's own; else the voice message's it came from; else the conversation's last; else the screen's (language on the message). A word to the running run in another language turns it. null on runs from before it was kept

      one of fa, en, null

    • created_bystring
    • created_atstring (date-time)
    • finished_atstring (date-time)
    • stepsAgentStep[]

      what the run changed in the project, in order

    • messagesobject[]

      what the person said to Agent while the run went

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/conversations/conversation" \
  -H "Authorization: Bearer $KEY"
DELETE/v1/projects/{project}/agent/conversations/{conversation}

Delete a conversation#

Stops its run if one is going and removes the conversation from the list.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • conversationstringمسیرالزامی

    the conversation's id (acv_…)

پاسخ

200object

  • idstring
  • deletedboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/agent/conversations/conversation" \
  -H "Authorization: Bearer $KEY"
PATCH/v1/projects/{project}/agent/conversations/{conversation}

Rename a conversation#

A new title, 1 to 120 characters.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • conversationstringمسیرالزامی

    the conversation's id (acv_…)

بدنهٔ درخواستapplication/json

  • titlestringالزامی

پاسخ

200AgentConversation

  • idstring

    acv_…

  • titlestring
  • archivedboolean

    an older conversation of the project, from before one conversation per project; readable, never continued

  • created_atstring (date-time)
  • updated_atstring (date-time)
  • created_bystring
  • last_runobject

خطاها

وضعیتتوضیح
400Bad request: bad_title
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl -X PATCH "https://api.ibel.ai/v1/projects/my-api/agent/conversations/conversation" \
  -H "Authorization: Bearer $KEY" \
  -d '{"title":"…"}'
POST/v1/projects/{project}/agent/conversations/{conversation}/runs

Send the next message of a conversation (older clients)#

Kept for older clients: the next message of that conversation (the project's one; an archived one answers 409 archived). Use POST …/agent/messages. One message at a time per project.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • conversationstringمسیرالزامی

    the conversation's id (acv_…)

بدنهٔ درخواستapplication/json

  • textstringالزامی

    the person's message, 1 to 32,000 characters

  • attachmentsstring[]

    ids of attachments of this project (aat_…), at most 10 and 100 MB together; Agent sees images and PDFs as they are and reads the text of documents, recordings and videos

    0–10 items

  • linksstring[]

    web addresses (http or https, on the public internet) for Agent to read itself, at most 10; addresses written in text are read too

    0–10 items

  • languagestring

    the language of the screen the message is sent from. Agent answers in the language of the message itself; this one is used when the message has none of its own (a name, code, a link, only files, "ok") and the conversation has none yet (default the person's saved language, else the request's Accept-Language, else fa)

    one of fa, en

  • voicestring

    the voice message (avj_…) the words came from, one of yours; the language it was spoken in counts when the words have none of their own

  • stand_in_textboolean

    true when text is the client's own stand-in for a message of only files or links; it then gives the message no language

پاسخ

201AgentRun

  • idstring

    arn_…

  • conversationstring
  • statusstring

    waiting: for the person (a question or an approval)

    one of queued, running, waiting, completed, failed, stopped

  • textstring

    the person's message

  • attachmentsAgentAttachment[]
  • linksstring[]

    the web addresses the message gave, which Agent read itself

  • replystring
  • questionsAgentQuestion[]
  • approvalsAgentApproval[]
  • costobject
  • languagestring

    the language Agent writes back in for this message: the message's own; else the voice message's it came from; else the conversation's last; else the screen's (language on the message). A word to the running run in another language turns it. null on runs from before it was kept

    one of fa, en, null

  • created_bystring
  • created_atstring (date-time)
  • finished_atstring (date-time)
  • stepsAgentStep[]

    what the run changed in the project, in order

  • messagesobject[]

    what the person said to Agent while the run went

خطاها

وضعیتتوضیح
400Bad request: bad_text, bad_attachment (also a file no longer stored: attach it again), bad_link, bad_language, bad_voice, bad_request
401unauthorized: missing, invalid, expired or revoked credential
402No credit: insufficient_credit; Agent's monthly limit reached for the team or the project: agent_spend_cap
403Forbidden: agent_off, agent_blocked, forbidden
404Not found: not_found
409Conflict: agent_busy, archived (an archived conversation)
413Too large: too_large (the files are over 100 MB together)
500internal: an unexpected failure
503Unavailable: agent_unavailable (Agent cannot be reached right now), agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/conversations/conversation/runs" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
GET/v1/projects/{project}/agent/runs

Agent's runs#

The project's messages to Agent and their runs, newest first; conversation narrows to one.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • conversationstringکوئری

    only this conversation's (acv_…)

  • any
  • any

پاسخ

200object

  • runsAgentRun[]
    • idstring

      arn_…

    • conversationstring
    • statusstring

      waiting: for the person (a question or an approval)

      one of queued, running, waiting, completed, failed, stopped

    • textstring

      the person's message

    • attachmentsAgentAttachment[]
    • linksstring[]

      the web addresses the message gave, which Agent read itself

    • replystring
    • questionsAgentQuestion[]
    • approvalsAgentApproval[]
    • costobject
    • languagestring

      the language Agent writes back in for this message: the message's own; else the voice message's it came from; else the conversation's last; else the screen's (language on the message). A word to the running run in another language turns it. null on runs from before it was kept

      one of fa, en, null

    • created_bystring
    • created_atstring (date-time)
    • finished_atstring (date-time)
    • stepsAgentStep[]

      what the run changed in the project, in order

    • messagesobject[]

      what the person said to Agent while the run went

  • next_cursorstring

خطاها

وضعیتتوضیح
400Bad request: bad_param, bad_cursor
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/runs" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/runs/{run}

One run#

A run as it stands: its status, reply, questions, approvals and cost.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • runstringمسیرالزامی

    the run's id (arn_…)

پاسخ

200AgentRun

  • idstring

    arn_…

  • conversationstring
  • statusstring

    waiting: for the person (a question or an approval)

    one of queued, running, waiting, completed, failed, stopped

  • textstring

    the person's message

  • attachmentsAgentAttachment[]
  • linksstring[]

    the web addresses the message gave, which Agent read itself

  • replystring
  • questionsAgentQuestion[]
  • approvalsAgentApproval[]
  • costobject
  • languagestring

    the language Agent writes back in for this message: the message's own; else the voice message's it came from; else the conversation's last; else the screen's (language on the message). A word to the running run in another language turns it. null on runs from before it was kept

    one of fa, en, null

  • created_bystring
  • created_atstring (date-time)
  • finished_atstring (date-time)
  • stepsAgentStep[]

    what the run changed in the project, in order

  • messagesobject[]

    what the person said to Agent while the run went

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/runs/run" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/runs/{run}/stream

Follow a run live#

Server-sent events while the run goes: status {status}, text {text} (each piece Agent writes), activity {what, action?, target?, url?} (what: editing_files, running_command, searching_web, reading_web, working_on_project, thinking; a change to the project adds action and target as in AgentStep), question (an AgentQuestion), approval (an AgentApproval, raised or decided), cost {credits, estimated_credits, settled} (the list price so far, while it runs), then done {status, reply, cost}; or error {code, message}. A comment every 15 seconds keeps it open. A finished run answers done at once.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • runstringمسیرالزامی

    the run's id (arn_…)

پاسخ

200stringtext/event-stream

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

درخواست
curl -N "https://api.ibel.ai/v1/projects/my-api/agent/runs/run/stream" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/runs/{run}/stop

Stop a run#

Stops the run; what it already changed stays (as previews).

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • runstringمسیرالزامی

    the run's id (arn_…)

پاسخ

200object

  • idstring
  • statusstring

    one of stopped

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
409Conflict: not_running
500internal: an unexpected failure
503Unavailable: agent_unavailable (Agent cannot be reached right now), agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/runs/run/stop" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/runs/{run}/message

Say something to a running Agent#

A few words Agent reads at its next step, without starting a new message.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • runstringمسیرالزامی

    the run's id (arn_…)

بدنهٔ درخواستapplication/json

  • textstringالزامی

    1 to 4,000 characters

  • languagestring

    the language of the screen it is sent from (checked, as on a message); words in another language than the run's turn the language Agent answers in

    one of fa, en

پاسخ

200object

  • deliveredboolean
  • messageobject

    the words as kept in the run's messages

    • textstring
    • atstring (date-time)
    • bystring

خطاها

وضعیتتوضیح
400Bad request: bad_text, bad_language
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
409Conflict: not_running
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/runs/run/message" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
POST/v1/projects/{project}/agent/runs/{run}/answer

Answer Agent's question#

The answer to a question Agent asked in the run; it carries on at once. A question that asks for an approval is answered on the approval.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • runstringمسیرالزامی

    the run's id (arn_…)

بدنهٔ درخواستapplication/json

  • questionstringالزامی
  • answerstringالزامی

    1 to 4,000 characters

پاسخ

200object

  • answeredboolean

خطاها

وضعیتتوضیح
400Bad request: bad_answer
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
409Conflict: not_running, already_answered, approval_question
500internal: an unexpected failure
503Unavailable: agent_unavailable (Agent cannot be reached right now), agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/runs/run/answer" \
  -H "Authorization: Bearer $KEY" \
  -d '{"question":"…","answer":"…"}'
GET/v1/projects/{project}/agent/approvals

Agent's approvals#

What Agent asked the person to approve, newest first: a production deploy, a custom domain, a paid resource or a top-up.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • statusstringکوئری

    one of pending, approved, denied, used, expired

پاسخ

200object

  • approvalsAgentApproval[]
    • idstring

      aap_…

    • runstring
    • kindstring

      paid_change: a create or resize that adds a standing monthly charge; destructive: deletes, replaces or rewinds something, free or not; paid_resource: older approvals only

      one of production_deploy, custom_domain, paid_change, destructive, topup, paid_resource

    • targetstring

      what it is for: an app or function's name, a resource kind, or the wallet

    • statusstring

      one of pending, approved, denied, used, expired

    • created_atstring (date-time)
    • decided_atstring (date-time)
    • decided_bystring
    • notestring
    • expires_atstring (date-time)
    • resultobject

      once approved, the action's own answer

    • costobject

      paid_change: the new charge per month

    • wallet_rialsinteger

      the team's wallet balance now

    • actionobject

      the exact call the approval is for, and the only one it is used by: its body with secrets shown as "[hidden]" and long text cut, or an upload's fingerprint

خطاها

وضعیتتوضیح
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/approvals" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/approvals/{approval}

Approve or deny#

The person's decision. On approve, the platform carries out the action Agent asked for and keeps its answer in result; Agent is told either way. A top-up needs the owner, admin or billing role; the payment link is made for the person who approves.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
owner, admin, developer (a top-up: owner, admin, billing)

پارامترها

  • any
  • approvalstringمسیرالزامی

    the approval's id (aap_…)

بدنهٔ درخواستapplication/json

  • decisionstringالزامی

    one of approve, deny

  • notestring

    at most 500 characters

پاسخ

200AgentApproval

  • idstring

    aap_…

  • runstring
  • kindstring

    paid_change: a create or resize that adds a standing monthly charge; destructive: deletes, replaces or rewinds something, free or not; paid_resource: older approvals only

    one of production_deploy, custom_domain, paid_change, destructive, topup, paid_resource

  • targetstring

    what it is for: an app or function's name, a resource kind, or the wallet

  • statusstring

    one of pending, approved, denied, used, expired

  • created_atstring (date-time)
  • decided_atstring (date-time)
  • decided_bystring
  • notestring
  • expires_atstring (date-time)
  • resultobject

    once approved, the action's own answer

  • costobject

    paid_change: the new charge per month

  • wallet_rialsinteger

    the team's wallet balance now

  • actionobject

    the exact call the approval is for, and the only one it is used by: its body with secrets shown as "[hidden]" and long text cut, or an upload's fingerprint

  • told_agentboolean

خطاها

وضعیتتوضیح
400Bad request: bad_decision
401unauthorized: missing, invalid, expired or revoked credential
403Forbidden: forbidden
404Not found: not_found
409Conflict: already_decided (decided, or expired after 30 minutes)
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/approvals/approval" \
  -H "Authorization: Bearer $KEY" \
  -d '{"decision":"approve"}'
POST/v1/projects/{project}/agent/attachments

Attach a file#

A file of any kind for a message (a picture, a PDF, a document, a sheet, an archive), at most 100 MB. Send the bytes as the body; then name its id in a message's attachments.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • content-sha256stringheaderالزامی

    the SHA-256 of the bytes, in hex; a different hash is refused and nothing is kept

  • content-lengthintegerheaderالزامی

    the size in bytes

  • x-file-namestringheaderالزامی

    the file's name, UTF-8, percent-encoded

بدنهٔ درخواستapplication/octet-stream

the file's bytes; its content-type is kept

string (binary)

پاسخ

201AgentAttachment

  • idstring

    aat_…

  • namestring
  • typestring
  • sizeinteger
  • kindstring

    one of file, voice

  • created_atstring (date-time)
  • heldboolean

    attached at the team level, before its project exists (POST /v1/agent/attachments); held 24 hours

خطاها

وضعیتتوضیح
400Bad request: bad_attachment, bad_hash
401unauthorized: missing, invalid, expired or revoked credential
403Forbidden: agent_off, forbidden
404Not found: not_found
411Length required: length_required
413Too large: too_large
500internal: an unexpected failure
503Unavailable: agent_unavailable (Agent cannot be reached right now), agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/attachments" \
  -H "Authorization: Bearer $KEY" \
  --data-binary @file
GET/v1/projects/{project}/agent/attachments/{attachment}

One attachment#

An attachment's name, type and size.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • attachmentstringمسیرالزامی

    the attachment's id (aat_…)

پاسخ

200AgentAttachment

  • idstring

    aat_…

  • namestring
  • typestring
  • sizeinteger
  • kindstring

    one of file, voice

  • created_atstring (date-time)
  • heldboolean

    attached at the team level, before its project exists (POST /v1/agent/attachments); held 24 hours

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/attachments/attachment" \
  -H "Authorization: Bearer $KEY"
DELETE/v1/projects/{project}/agent/attachments/{attachment}

Delete an attachment#

Removes the file.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • attachmentstringمسیرالزامی

    the attachment's id (aat_…)

پاسخ

200object

  • idstring
  • deletedboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/agent/attachments/attachment" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/voice

A voice message#

A recorded voice message (at most 10 MB), turned into text for the chat box. Nothing is sent to Agent: the person reads the text, fixes it if needed and sends it as a message.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any
  • content-sha256stringheaderالزامی

    the SHA-256 of the bytes, in hex; a different hash is refused and nothing is kept

  • content-lengthintegerheaderالزامی

    the size in bytes

  • asyncstringکوئری

    1: answer 202 at once with the job (AgentVoiceJob) and poll GET …/voice/{voice} for the text; without it the call waits for the text (up to a few minutes). Prefer: respond-async does the same.

    one of 1, true

بدنهٔ درخواستaudio/webm

the recording

string (binary)

پاسخ

200object

  • textstring
  • attachmentAgentAttachment
    • idstring

      aat_…

    • namestring
    • typestring
    • sizeinteger
    • kindstring

      one of file, voice

    • created_atstring (date-time)
    • heldboolean

      attached at the team level, before its project exists (POST /v1/agent/attachments); held 24 hours

202AgentVoiceJobAccepted (with ?async=1): the job, working; Location is its address

  • idstring

    avj_…

  • statusstring

    one of working, done, failed

  • textstring

    when done, the text for the box

  • errorobject

    when failed: {code, message}

  • attachmentAgentAttachment
  • formatstring

    the recording's format (webm, m4a, ogg, ...)

  • languagestring | null

    the language found in it (fa, en), once done

  • secondsnumber

    seconds since it was sent, or until it finished

  • accepted_snumber | null
  • created_atstring (date-time)
  • finished_atstring (date-time) | null

خطاها

وضعیتتوضیح
400Bad request: bad_audio, bad_hash
401unauthorized: missing, invalid, expired or revoked credential
402No credit: insufficient_credit
403Forbidden: agent_off, forbidden
404Not found: not_found
411Length required: length_required
413Too large: too_large
415Unsupported: bad_audio (a recording that cannot be read)
500internal: an unexpected failure
503Unavailable: voice_failed, agent_unavailable, agent_busy

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/voice" \
  -H "Authorization: Bearer $KEY" \
  --data-binary @file
GET/v1/projects/{project}/agent/voice/{voice}

A voice message's text#

A voice message sent with ?async=1: working until its text is ready (seconds to minutes), then done with text, or failed with error ({code, message}: voice_failed, bad_audio, ...). Ask again every 2 s or so; each ask is answered at once. Only the person who sent it sees it; kept a day.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • projectstringمسیرالزامی

    the project's name or id

  • voicestringمسیرالزامی

    the voice message's job id (avj_…)

پاسخ

200AgentVoiceJob

  • idstring

    avj_…

  • statusstring

    one of working, done, failed

  • textstring

    when done, the text for the box

  • errorobject

    when failed: {code, message}

  • attachmentAgentAttachment
  • formatstring

    the recording's format (webm, m4a, ogg, ...)

  • languagestring | null

    the language found in it (fa, en), once done

  • secondsnumber

    seconds since it was sent, or until it finished

  • accepted_snumber | null
  • created_atstring (date-time)
  • finished_atstring (date-time) | null

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/voice/voice" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/preview

The preview pane#

The project's newest preview (the app or function whose preview changed last), the same one's production address, and its newest 20 versions, each marked when it is the preview's or production's.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any

پاسخ

200object

  • previewobject
  • productionobject
  • versionsobject[]

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/preview" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/usage

Agent's usage#

Runs, credits and rials per day (Tehran) over the last days (1 to 90, default 30).

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any
  • daysintegerکوئری

    1–90 · default 30

پاسخ

200object

  • daysobject[]
  • totalobject
  • monthobject

    this billing month against Agent's monthly limits, in credits; once either is reached a new message is refused with agent_spend_cap and a run still working stops

خطاها

وضعیتتوضیح
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/usage" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/conversation

The project's conversation#

The project's one conversation with Agent and its runs, oldest first (the last 200), with how many older conversations are archived.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any

پاسخ

200object

  • conversationAgentConversation
  • runsAgentRun[]
  • archivedinteger

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/conversation" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/messages

The project's next message#

The next message of the project's one conversation (made on the first message), which Agent starts working on at once; follow it with the run's stream. Before each message Agent is told the latest commit of each app on main and on its own branch, agent. One message at a time per project. Needs credit.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any

بدنهٔ درخواستapplication/json

  • textstringالزامی

    the message, 1 to 32,000 characters

  • attachmentsstring[]

    attachment ids of this project, or held ones (POST /v1/agent/attachments); at most 100 MB together

    0–10 items

  • linksstring[]

    web addresses for Agent to read itself, at most 10

    0–10 items

  • languagestring

    the language of the screen the message is sent from. Agent answers in the language of the message itself; this one is used when the message has none of its own (a name, code, a link, only files, "ok") and the conversation has none yet (default the person's saved language, else the request's Accept-Language, else fa)

    one of fa, en

  • voicestring

    the voice message (avj_…) the words came from, one of yours; the language it was spoken in counts when the words have none of their own

  • stand_in_textboolean

    true when text is the client's own stand-in for a message of only files or links; it then gives the message no language

پاسخ

201AgentRun

  • idstring

    arn_…

  • conversationstring
  • statusstring

    waiting: for the person (a question or an approval)

    one of queued, running, waiting, completed, failed, stopped

  • textstring

    the person's message

  • attachmentsAgentAttachment[]
  • linksstring[]

    the web addresses the message gave, which Agent read itself

  • replystring
  • questionsAgentQuestion[]
  • approvalsAgentApproval[]
  • costobject
  • languagestring

    the language Agent writes back in for this message: the message's own; else the voice message's it came from; else the conversation's last; else the screen's (language on the message). A word to the running run in another language turns it. null on runs from before it was kept

    one of fa, en, null

  • created_bystring
  • created_atstring (date-time)
  • finished_atstring (date-time)
  • stepsAgentStep[]

    what the run changed in the project, in order

  • messagesobject[]

    what the person said to Agent while the run went

خطاها

وضعیتتوضیح
400Bad request: bad_text, bad_attachment, bad_link, bad_language, bad_voice, bad_request, bad_json
401unauthorized: missing, invalid, expired or revoked credential
402No credit: insufficient_credit; Agent's monthly limit reached for the team or the project: agent_spend_cap
403Forbidden: agent_blocked, forbidden, agent_key
404Not found: not_found
409Conflict: agent_busy (the project's last message is still being worked on)
413Too large: too_large
500internal: an unexpected failure
503Unavailable: agent_unavailable, agent_not_available (not a retry: contact support), agent_busy (busy; retry_after seconds)

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/messages" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
POST/v1/projects/{project}/agent/stop

Stop Agent on the project#

A running message stops and Agent's key for the project is revoked at once. Agent stays available: the next message makes a new key.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any

پاسخ

200object

  • stoppedboolean

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
403Forbidden: forbidden
404Not found: not_found
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/stop" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/agent/deploy

What deploying Agent's preview carries#

For the deploy dialog: each app's agent preview version against production, file counts, new bindings and variables, the table changes as SQL (schema only), new monthly costs in production and the wallet balance. Rows made while testing stay in the preview; production keeps its own data.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
همهٔ نقش‌ها

پارامترها

  • any

پاسخ

200AgentDeploy

  • itemsobject[]
  • costsobject[]

    new standing monthly charges in production

  • wallet_rialsinteger
  • notestring

    rows made while testing stay in the preview; production keeps its own data

خطاها

وضعیتتوضیح
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

نمونه

curl "https://api.ibel.ai/v1/projects/my-api/agent/deploy" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/agent/deploy

Deploy Agent's preview to production#

As the person: each app's agent preview version goes to production (apps: only these). Agent's own key is refused.

دسترسی
کلید API یا نشست داشبورد
نقش‌ها
مالک، ادمین، توسعه‌دهنده

پارامترها

  • any

بدنهٔ درخواستapplication/json

  • appsstring[]

    app and function names (default every one whose agent preview differs from production)

  • versionsmap of integer

    the preview version the dialog showed for each app ({name: version}); a preview that moved since is refused (preview_changed)

پاسخ

200object

  • deployedobject[]
    • appstring
    • versioninteger
    • urlstring

خطاها

وضعیتتوضیح
400Bad request: bad_apps, bad_versions
401unauthorized: missing, invalid, expired or revoked credential
403Forbidden: forbidden, agent_key
404Not found: not_found
409Conflict: nothing_to_deploy, preview_changed
500internal: an unexpected failure

نمونه

curl -X POST "https://api.ibel.ai/v1/projects/my-api/agent/deploy" \
  -H "Authorization: Bearer $KEY" \
  -d '{"apps":["…"],"versions":{"KEY":1}}'