{"method":"POST","path":"https://api.revcent.com/v2/ai_assistants/{ai_assistant_id}/trigger","summary":"Trigger An AI Assistant","description":"Trigger a specific AI Assistant using the AI Assistant ID and trigger path. Triggering an AI Assistant will generate a unique AI Thread that will run autonomously.<br><br>Note: You can only trigger an AI Assistant with a trigger setting of 'on_demand' using the API. If you do not know an AI Assistant's ID, get the list of AI Assistant's using the GetAIAssistants operation, then find the ID for the AI Assistant you wish to trigger. If you are providing a previous_thread_id do not provide the messages array. View markdown documentation at https://revcent.com/documentation/markdown/mcp/operation/TriggerAIAssistant.md for an in-depth overview of this operation.","operationId":"TriggerAIAssistant","parameters":[{"in":"path","name":"ai_assistant_id","description":"The AI Assistant ID","required":true,"schema":{"type":"string","title":"AI Assistant ID","description":"A 20 character AI Assistant ID.","minLength":20,"maxLength":20}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"source_type":{"type":"string","description":"Only provide if you are triggering an AI Assistant for a specific item in RevCent, i.e a sale, customer, etc.","enum":["item"]},"item_type":{"type":"string","description":"Only provide if source type is 'item'. Specify the item type.","enum":["sale","customer","product_sale","shipping","subscription","subscription_renewal","salvage_transaction","transaction","chargeback","fraud_detection"]},"item_id":{"type":"string","description":"Only provide if source type is 'item'. Provide the ID of the item corresponding to the item_type.","minLength":20,"maxLength":20},"previous_ai_thread":{"type":"object","additionalProperties":false,"description":"If you are triggering the AI Assistant and wish to pass an existing AI Thread to the AI Assistant.","properties":{"ai_thread_id":{"type":"string","title":"AI Thread ID","description":"A 20 character AI Thread ID.","minLength":20,"maxLength":20},"include_messages":{"description":"Indicate whether to pass the existing AI Threads' messages when triggering the AI Assistant. This will consume more tokens and is only recommended if the existing AI Thread context is necessary.","type":"boolean"}}},"messages":{"description":"Optionally provide any new messages you wish to include when triggering the AI Assistant. If you are providing a previous_ai_thread and include_messages is equal to true, do not include duplicate existing AI Thread messages from the previous thread.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"role":{"description":"The role associated with the message.","type":"string","enum":["user","system"]},"content":{"description":"The content of the message.","type":"string"}}}}},"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"description":"","properties":{"api_call_id":{"type":"string","description":"A 20 character API call ID.","minLength":20,"maxLength":20},"api_call_unix":{"description":"Unix timestamp of when the API call was initiated.","type":"integer","format":"unix-time"},"code":{"description":"API call response code.","type":"integer","format":"int32","enum":[1]},"ai_thread_id":{"type":"string","title":"AI Thread ID","description":"A 20 character AI Thread ID.","minLength":20,"maxLength":20},"ai_assistant_id":{"type":"string","title":"AI Assistant ID","description":"A 20 character AI Assistant ID.","minLength":20,"maxLength":20},"result":{"type":"string"}},"type":"object","additionalProperties":false}}},"description":"Successful response."},"default":{"content":{"application/json":{"schema":{"description":"","properties":{"api_call_id":{"type":"string","description":"A 20 character API call ID.","minLength":20,"maxLength":20},"api_call_unix":{"description":"Unix timestamp of when the API call was initiated.","type":"integer","format":"unix-time"},"code":{"description":"This value indicates that there is an error. Will always be 0.","type":"integer","enum":[0]},"error_code":{"description":"The specific error code.","type":"string"},"message":{"description":"A human readable description of the error.","type":"string"},"result":{"description":"A description of the API call result.","type":"string"}},"title":"APIStandardErrors","type":"object","additionalProperties":false}}},"description":"Error response."}}}