ai.v1.AssistantService
SendMessage
SendMessage records the caller's message and starts a run that answers it. It returns once the run is recorded; follow the run with WatchRun. A conversation runs one run at a time. It is idempotent per caller and key: repeat the request unchanged to resolve an unknown outcome. Errors: - INVALID_ARGUMENT: malformed request. - NOT_FOUND: CONVERSATION_NOT_FOUND. - FAILED_PRECONDITION: RUN_ACTIVE; nothing is recorded. - ALREADY_EXISTS: IDEMPOTENCY_CONFLICT; the original run stands. - RESOURCE_EXHAUSTED: USAGE_LIMIT_REACHED; retry later. - UNAVAILABLE, DEADLINE_EXCEEDED: SERVICE_UNAVAILABLE or an unknown outcome; retry the same request. - UNAUTHENTICATED: missing or invalid credentials.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/ai.v1.AssistantService/SendMessage' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"conversationId": "1",
"destinations": [
{
"description": "Example configuration for the API playground.",
"id": "value",
"title": "My Trading Board"
}
],
"idempotencyKey": "idem_01J5EXAMPLE0000000000000",
"subaccountId": "6789012345678",
"text": "example"
}'Responses
{
"conversationId": "1",
"runId": "1"
}ai.v1.SendMessageRequestai.v1.SendMessageResponseConversation to continue. Omit to start a new conversation.
Message text, plain text or Markdown, 1 to 16000 characters.
Client-chosen key, unique per caller, that makes sending idempotent: the same key and request return the same run and conversation, also for a new conversation; another request with the same key is IDEMPOTENCY_CONFLICT.
Trading account (subaccount) the run reads and acts on. It must be one the caller's account owns; any other value, also one that does not exist, is INVALID_ARGUMENT. Omit it to answer without account data: the run then has no account tools. It is part of the request the idempotency key covers. Public ID. ConnectRPC carries it as fixed64 (a decimal string in JSON).
The places in the client the run may suggest to the user, at most 100, each id at most once; their order does not matter. Omit them for a client that cannot take the user anywhere: the run then suggests nothing. They are part of the request the idempotency key covers.
The run that answers the message. Follow it with WatchRun.
The conversation of the message: the requested one, or the new one.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |