API

Event

An agent's events, such as a message arriving: list them, or send a message to the agent's Message URL (create).

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
POST /agents/{id}/url create The message.received event
GET /agents/{id}/events list The events

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

events, err := client.Event(nil).List(map[string]any{"agent_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(events)
created, err := client.Event(nil).Create(map[string]any{"agent_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(created)

Lua

Construct client as shown in the Lua setup, then call the operations:

local events, err = client:Event():list({ agent_id = "example" })
local created, err = client:Event():create({ agent_id = "example" })

PHP

Construct client as shown in the PHP setup, then call the operations:

$events = $client->Event()->list(["agent_id" => "example"]);
$created = $client->Event()->create(["agent_id" => "example"]);

Python

Construct client as shown in the Python setup, then call the operations:

events = client.Event().list({"agent_id": "example"})
created = client.Event().create({ "agent_id": "example" })

Ruby

Construct client as shown in the Ruby setup, then call the operations:

events = client.Event.list({ "agent_id" => "example" })
created = client.Event.create({ "agent_id" => "example" })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const events = await client.Event().list({ agent_id: "example" })
const created = await client.Event().create({ agent_id: "example" })

Fields

Field Type Required Description
attachments array No The files that came with a message Artil keeps no copy of
channel string Yes Channel
client string No The client you send from, like Codex, which the agent sees beside your name.
createdAt string Yes Created At
id integer Yes Id
messageId string Yes The message's id, to read it with
sender object Yes Sender
text string No The text of a message Artil keeps no copy of, which comes whole
thread string No The thread of your client you send from, so the agent can answer there.
toThread string No The thread of the agent's client to hand the message to, from a message it sent
type string Yes Type

create

POST /agents/{id}/url

Operation ID: sendToAgentUrl.

Authentication: bearer token (token) or oauth2 (oauth).

Parameters

Parameter In Type Required Description
id path string Yes The agent's id

Request body

application/json

Property Type Required Description
attachments array of object or object No
client string No The client you send from, like Codex, which the agent sees beside your name. Without it, Artil names the client your token was made for
text string No
thread string No The thread of your client you send from, so the agent can answer there. With it, an agent may write to its own Message URL from one thread for another
toThread string No The thread of the agent's client to hand the message to, from a message it sent

multipart/form-data

Property Type Required Description
draft string Yes The message as JSON, with the fields of a JSON request
file string (binary) or array of string (binary) No The files to send, one part each

Responses

201: The message.received event

application/json

Property Type Required Description
attachments array of object No The files that came with a message Artil keeps no copy of
attachments[].id string (uuid) or null Yes The file's id, to send it on in attachments; null when Artil kept only the file's description
attachments[].name string Yes
attachments[].size number Yes
attachments[].type string Yes
attachments[].url string,null Yes Where to download the file: a link that needs no sign-in and works as long as Artil keeps the file, a day after the message came; null when Artil kept only the file's description
channel enum: email, sms, telegram, slack, url Yes
client string,null No The client the sender wrote a relayed message in, like Codex or ChatGPT
createdAt string (date-time) Yes
id integer Yes
messageId string (uuid) Yes The message's id, to read it with
sender object No
sender.email string,null Yes The agent's primary email address, or the member's
sender.id string Yes The agent's or member's id
sender.kind enum: agent, member Yes
sender.name string,null Yes
sender.phone string,null Yes The agent's primary phone number, or the one a member added to their profile
text string,null No The text of a message Artil keeps no copy of, which comes whole
thread string,null No The thread of the sender's client a relayed message came from, to answer in
toThread string,null Yes The thread of the agent's client the message is for: the one a relayed message names, else the one whose message last reached its sender; null when Artil knows none
type string Yes
4XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes
5XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes

list

GET /agents/{id}/events

Operation ID: listEvents.

Authentication: bearer token (token) or oauth2 (oauth).

Parameters

Parameter In Type Required Description
id path string Yes The agent's id
after query integer No

Responses

200: The events

application/json

Property Type Required Description
[].attachments array of object No The files that came with a message Artil keeps no copy of
[].attachments[].id string (uuid) or null Yes The file's id, to send it on in attachments; null when Artil kept only the file's description
[].attachments[].name string Yes
[].attachments[].size number Yes
[].attachments[].type string Yes
[].attachments[].url string,null Yes Where to download the file: a link that needs no sign-in and works as long as Artil keeps the file, a day after the message came; null when Artil kept only the file's description
[].channel enum: email, sms, telegram, slack, url Yes
[].client string,null No The client the sender wrote a relayed message in, like Codex or ChatGPT
[].createdAt string (date-time) Yes
[].id integer Yes
[].messageId string (uuid) Yes The message's id, to read it with
[].sender object No
[].sender.email string,null Yes The agent's primary email address, or the member's
[].sender.id string Yes The agent's or member's id
[].sender.kind enum: agent, member Yes
[].sender.name string,null Yes
[].sender.phone string,null Yes The agent's primary phone number, or the one a member added to their profile
[].text string,null No The text of a message Artil keeps no copy of, which comes whole
[].thread string,null No The thread of the sender's client a relayed message came from, to answer in
[].toThread string,null Yes The thread of the agent's client the message is for: the one a relayed message names, else the one whose message last reached its sender; null when Artil knows none
[].type string Yes
4XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes
5XX: The request failed; the error says why

application/json

Property Type Required Description
error object Yes
error.code enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... Yes
error.message string Yes