{"method":"POST","path":"https://api.revcent.com/v2/functions/{function_id}/trigger","summary":"Trigger A Function","description":"Trigger a specific Function using the Function ID and trigger path. Note: Only Functions configured in the web app with a trigger setting of 'api_direct' are triggerable via the API. DO NOT trigger a Function unless explicitly told to do so by the user. Carefully review any custom arguments from the source function. If triggering a Function in reference to, or during the processing of a specific item, retrieve the details of the item using the appropriate Get operation specific to the item_type and item_id before triggering the function in order to infer the correct custom argument value(s). View markdown documentation at https://revcent.com/documentation/markdown/mcp/operation/TriggerFunction.md for an in-depth overview of this operation.","operationId":"TriggerFunction","parameters":[{"in":"path","name":"function_id","description":"The Function ID. If you do not have a Function ID, or a function ID is invalid, automatically get a list of available Functions using the GetFunctions operation and find the appropriate function and its ID.","required":true,"schema":{"type":"string","title":"Function ID","description":"A 20 character Function ID.","minLength":20,"maxLength":20}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"item_type":{"type":"string","description":"If triggering a Function in reference to, or during the processing of a specific 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":"If triggering a Function in reference to, or during the processing of a specific item, provide the ID of the item corresponding to the item_type.","minLength":20,"maxLength":20},"custom_arguments":{"description":"An array of custom arguments, specific to the Function being triggered if the Function has a non-empty custom_arguments array. When triggering a Function with custom_arguments, it is extremely important to review the Functions' custom_arguments array and provide the necessary custom arguments with their generated values.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"name":{"description":"The name of the custom argument, which should be the name within the custom_arguments array from the source Function being triggered.","type":"string"},"value":{"description":"The value of the custom argument. Carefully read the custom arguments' Description from the Function to infer and generate the Value to submit. The custom arguments' source description is the instructions on generating the custom arguments' Value.","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]},"function_id":{"type":"string","title":"Function ID","description":"A 20 character Function ID.","minLength":20,"maxLength":20},"function_run_id":{"type":"string","description":"A 20 character Function Run ID which is specific to the Function trigger operation.","minLength":20,"maxLength":20},"function_response":{"type":"string","description":"The function response is determined by the RevCent users function code."},"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."}}}