# Run agent

This endpoint runs the agent with the provided input message.

Source: https://zild.ai/en-US/docs/api-reference/post-api-Agent-run

POST `/Agent/run`

This endpoint runs the agent with the provided input message.

## Authentication

**Authentication required.** Send your user API key in the X-API-Key header.

## Parameters

This operation has no path, query, or header parameters.

## Request body

**Content type:** `multipart/form-data` · **Schema:** `object`



<table class="api-params"><thead><tr><th>Property</th><th>Type</th><th>Required</th><th>Description</th><th>Constraints</th></tr></thead><tbody><tr><td><code>file</code></td><td><code>string · binary</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>AgentId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>ConversationId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>UserInputMessage</code></td><td><code>string</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>MessageType</code></td><td><code>MessageType</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>ProgressRunId</code></td><td><code>string</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>DocumentId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>—</td></tr></tbody></table>



## Example request



```
curl --request POST \
  --url 'https://api.zild.ai/Agent/run' \
  --header 'X-API-Key: YOUR_USER_API_KEY' \
  --form 'file=@file' \
  --form 'AgentId={AgentId}' \
  --form 'ConversationId={ConversationId}' \
  --form 'UserInputMessage={UserInputMessage}' \
  --form 'MessageType={MessageType}' \
  --form 'ProgressRunId={ProgressRunId}' \
  --form 'DocumentId={DocumentId}'
```



## Responses



<table class="api-params"><thead><tr><th>Status</th><th>Description</th><th>Response body</th></tr></thead><tbody><tr><td><code>200</code></td><td>Execution completed successfully</td><td><code>application/json</code> · <code>AgentRunTextResponseDto</code></td></tr></tbody></table>

**Example response (200):**



```
{
  "conversationId": 0,
  "userMessageId": 0,
  "attachmentMessageId": 0,
  "assistantMessageId": 0,
  "reply": "string"
}
```



## Data models

`AgentRunTextResponseDto`

<table class="api-params"><thead><tr><th>Property</th><th>Type</th><th>Required</th><th>Description</th><th>Constraints</th></tr></thead><tbody><tr><td><code>conversationId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>userMessageId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>attachmentMessageId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>nullable</td></tr><tr><td><code>assistantMessageId</code></td><td><code>integer · int32</code></td><td>No</td><td>—</td><td>—</td></tr><tr><td><code>reply</code></td><td><code>string</code></td><td>No</td><td>—</td><td>nullable</td></tr></tbody></table>

`MessageType`0 = Text; 1 = Image; 2 = File; 3 = Audio; 4 = Video; 5 = Internal; 6 = TemplateMarketing; 7 = TemplateUtility; 8 = Location; 9 = Contact

`integer`
