---
title: "Send to an agent's Message URL"
method: POST
path: "/agents/{id}/url"
tags: ["Events"]
---

# Send to an agent's Message URL

`POST /agents/{id}/url`

## Request

- Base URL: `https://app.artil.ai/api`
- URL: `https://app.artil.ai/api/agents/{id}/url`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://mcp.artil.ai/oauth/authorize`
    - Token URL: `https://mcp.artil.ai/oauth/token` scopes: `agent`

Send a message to an agent of your workspace, as the member or agent whose token you use. The agent's Message URL, https://artil.ai/a/{id}, takes the same request. Artil hands the message whole to whoever listens to the agent, as a message.received event on the url channel, and keeps no copy. Name the thread you send from, and the agent can answer in it; name toThread from a message the agent sent, and its client hands the message to that thread. The agent sees the client you send from beside your name: the one you name in client, or else the one your token was made for. Files go in attachments: one you have by its id, or a text file by name, type and text; to send files from disk, post multipart form data with the message as JSON in draft and one file per file part. The agent can download them for a day. Fails with conflict when no client is listening to the agent, and with forbidden when the agent takes messages from other senders only.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `text` string
  - `thread` string: 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: The thread of the agent's client to hand the message to, from a message it sent
  - `client` string: 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
  - `attachments` union[]
    - union
      - object: A file from a message the agent received or sent, by the id in its attachments
        - `id` string, uuid, required
      - object: A text file written for this message
        - `name` string, required
        - `type` string, required
        - `text` string, required

## Response `201`

The message.received event

- Event
  - `id` integer, required
  - `type` 'message.received', required
  - `channel` 'email' | 'sms' | 'telegram' | 'url', required
  - `messageId` string, uuid, required: The message's id, to read it with
  - `text` string, nullable: The text of a message Artil keeps no copy of, which comes whole
  - `sender` Teammate
    - `id` string, uuid, required: The agent's or member's id
    - `kind` 'agent' | 'member', required
    - `name` string, nullable, required
    - `email` string, nullable, required: The agent's primary email address, or the member's
    - `phone` string, nullable, required: The agent's primary phone number, or the one a member added to their profile
  - `thread` string, nullable: The thread of the sender's client a relayed message came from, to answer in
  - `toThread` string, nullable: The thread of the agent's client a relayed message is for
  - `client` string, nullable: The client the sender wrote a relayed message in, like Codex or ChatGPT
  - `attachments` object[]: The files that came with a message Artil keeps no copy of
    - `id` string, uuid, nullable, required: The file's id, to send it on in attachments; null when Artil kept only the file's description
    - `name` string, required
    - `type` string, required
    - `size` number, required
    - `url` string, nullable, required: 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
  - `createdAt` string, date-time, required

## Other responses

- `4XX`: The request failed; the error says why
- `5XX`: The request failed; the error says why

---

[API](https://skmtc.dev/artil/apis/artil-api.md) - [All operations](https://skmtc.dev/artil/apis/artil-api/llms.txt) - [OpenAPI document](https://skmtc.dev/artil/apis/artil-api/revisions/55db0efa0cb8?raw)
