{"method":"GET","path":"https://api.revcent.com/v2/functions","summary":"Get Functions","description":"Returns a list of Functions.<br><br>Note: The function code is not provided when retrieving a list of functions. To get the code for a specific function, use the GetFunction operation with the function ID. When triggering a Function it is extremely important to review the custom_arguments array for the Function first and provide the necessary custom arguments with their values in the TriggerFunction operation.","operationId":"GetFunctions","parameters":[{"description":"A limit on the number of objects to be returned. Limit can range between 1 and 25, and the default is 25.","in":"query","name":"limit","required":true,"schema":{"type":"integer","format":"int32","minimum":1,"maximum":25},"style":"form"},{"description":"Used for pagination, i.e. to skip to specific page of results.","in":"query","name":"page","required":true,"schema":{"type":"integer","format":"int32"},"style":"form"}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"encoding":{},"schema":{"additionalProperties":false,"properties":{},"type":"object"}}},"required":false},"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]},"current_count":{"description":"The current number of items in the results.","type":"integer"},"current_page":{"description":"The current page for the items in the results.","type":"integer"},"results":{"items":{"allOf":[{"type":"object","additionalProperties":false,"properties":{"created_date_unix":{"description":"The unix timestamp of when the item was created.","type":"integer","format":"unix-time"},"id":{"type":"string","title":"Email Template ID","description":"A 20 character Email Template ID.","minLength":20,"maxLength":20},"name":{"description":"The name of the Function.","type":"string"},"description":{"description":"The description of the Function.","type":"string"},"enabled":{"description":"Whether the Function is currently enabled and able to be triggered.","type":"boolean"},"event_source":{"description":"The event source setting determines how the Function will be triggered, a.k.a. code executed.\nTrigger Options:\nAccount Event: Function is triggered by RevCent automatically when a specific event occurs.\nSchedule: Function is triggered by RevCent on a fixed schedule using a cron expression.\nURL: Trigger the function using a HTTP GET or POST request with a response determined by the function. Useful for performing immediate operations or requesting data.\nWebhook: Send a notification to the function with an empty response using a HTTP POST request. Useful for allowing third parties to post data.\nAPI/AI: Trigger the function using the RevCent API, as an AI System Tool, as a Filter Function or as a Pre-Agent function.\nEmail Template: Generate custom data for an Email Template\nPayment Profile: Run a function during the processing of a Next-Gen payment profile.","type":"string","enum":["account_event","api_direct","email_template","payment_profile","function_url","schedule"]},"account_event_notations":{"type":"array","description":"If the event_source is set to 'account_event', you can specify one or more account event notations to trigger the function when those specific account events occur. An account event notation is a string that represents a specific account event. When the specified account event(s) occur, the system will trigger the function to run the associated code.","items":{"type":"string","description":"The notation for the account event trigger. Read more at https://kb.revcent.com/en/revcent-account/events to understand notation formatting and their associated event data.","enum":["ai_memo.created","chargeback.created","check_direct.created","customer.created","customer.updated.add_card","customer.updated.address","customer.updated.customer_group","customer.updated.customer_group.added","customer.updated.customer_group.removed","customer.updated.disabled","customer.updated.enabled","discount.created","fraud_detection.created","fraud_detection.updated.false_positive","invoice.created","note.created","offline_payment.created","paypal_dispute.created","paypal_transaction.created","pending_refund.created","pending_refund.created.product_sale","pending_refund.created.product_sale.full","pending_refund.created.product_sale.partial","pending_refund.created.shipping","pending_refund.created.shipping.full","pending_refund.created.shipping.full.has_fulfillment","pending_refund.created.shipping.full.no_fulfillment","pending_refund.created.shipping.has_fulfillment","pending_refund.created.shipping.no_fulfillment","pending_refund.created.shipping.partial","pending_refund.created.shipping.partial.has_fulfillment","pending_refund.created.shipping.partial.no_fulfillment","pending_refund.created.subscription_renewal","pending_refund.created.subscription_renewal.full","pending_refund.created.subscription_renewal.partial","pending_refund.created.tax","pending_refund.created.tax.full","pending_refund.created.tax.partial","product.created","product.deleted","product.updated","product_sale.created","sale.created","sale.created.failed","sale.created.failed.declined","sale.created.failed.error","sale.created.failed.no_gateway","sale.created.failed.fraud_detected","sale.created.failed.merchant_error","sale.created.failed.merchant_hold","sale.created.success","sale.created.success.has_salvage","sale.created.success.is_upsell","sale.created.success.paid","sale.created.success.paid.has_salvage","sale.created.success.paid.is_upsell","sale.created.success.pending","sale.created.success.pending.is_upsell","sale.updated.fraud_alert.added","sale.updated.fraud_alert.removed","salvage_transaction.created","salvage_transaction.updated.processed","salvage_transaction.updated.processed.failed","salvage_transaction.updated.processed.success","sentinel.alert","sentinel.alert.fraud_detected","sentinel.alert.firewall_block","shipping.created","shipping.created.has_fulfillment","shipping.created.no_fulfillment","shipping.updated.delivered","shipping.updated.ship_to","shipping.updated.shipped","subscription.created","subscription.updated.renewed","subscription.updated.renewed.failed","subscription.updated.renewed.success","subscription.updated.status","subscription.updated.status.active","subscription.updated.status.cancelled","subscription.updated.status.occurrence_limit","subscription.updated.status.overdue","subscription.updated.status.suspended","subscription_renewal.updated.failed","subscription_renewal.updated.success","tax.created","transaction.created","trial.created","trial.updated.cancelled","trial.updated.expired","trial.updated.expired.failed","trial.updated.expired.success","trial.updated.extended","trial.updated.shortened"]}},"account_event_filters":{"type":"object","additionalProperties":false,"description":"If the event_source is set to 'account_event', filters can be applied to account events to determine whether the function should be triggered when the specified account event(s) occur. For example, if you only want a function to trigger when a sale is made for a specific campaign, you can set up a filter for one or more campaign ID's. When the account event occurs, the system will check if the filters are met before triggering the function to run the associated code.","properties":{"campaign_filter":{"description":"The campaign filter checks for the presence of one or more campaign ID's in the related event, and if present whether it matches the specified value.","type":"array","items":{"type":"string","description":"A 20 character campaign ID to filter for."}}}},"dependencies":{"description":"A list of dependencies required for the Function. Only specific dependencies are supported. Dependencies are accessed within the function code using the 'global[\"<dependency_name>\"]' syntax. Do not use require(), import, or any other module loading mechanism as dependencies are already available via the global object.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"name":{"description":"The name of the dependency.","type":"string","enum":["@mailchimp/mailchimp_marketing","@mailchimp/mailchimp_transactional","@sendgrid/mail","@slack/web-api","activecampaign","ajv","ascii-table","axios","crypto-js","facebook-nodejs-business-sdk","google-ads-api","google-libphonenumber","handlebars","html-to-text","input","json2csv","jsonwebtoken","klaviyo-sdk","lodash","mathjs","moment","moment-timezone","mongodb","mysql","nodemailer","openai","pg","qs","redis","request","shippo","superagent","twilio","uuid","validator","xml2js"]},"version":{"description":"The version of the dependency. Please ensure that the version exists and is valid to prevent errors when triggering the function.","type":"string"}}}},"environment_variables":{"description":"A list of environment variables that are available to the Function when it is triggered. Environment variables are accessed within the function code using the 'process.env[\"<env_variable_name>\"]' syntax. When a function is triggered, encrypted environment variables are decrypted and provided to the function, but when retrieving function details via the API, encrypted environment variable values are hidden and not provided. This allows you to have sensitive information such as API keys stored as encrypted environment variables, which can be used by the function when triggered, but are not exposed when retrieving function details.","type":"array","items":{"type":"object","additionalProperties":false,"properties":{"name":{"description":"The name of the environment variable, which would be accessed within the function code using the 'process.env[\"<env_variable_name>\"]' syntax.","type":"string"},"value":{"description":"The value of the environment variable. If the environment variable is encrypted, this value will be hidden and not provided when retrieving the details of the function.","type":"string"},"encrypted":{"description":"Whether the environment variable is encrypted. If true, the value will be hidden and not provided when retrieving the details of the function.","type":"boolean"}}}},"function_url":{"description":"The function URL is the unique URL that can be used to trigger the function directly via a HTTP GET or POST request. The function URL is only present for functions with the event_source set to 'function_url'.","type":"string","format":"uri"},"webhook_url":{"description":"The webhook URL is the unique URL that can be used to trigger the function directly via a HTTP POST request. The webhook URL is only present for functions with the event_source set to 'webhook'.","type":"string","format":"uri"},"ip_restricted":{"description":"Whether the function is IP restricted. If true, only requests originating from allowed IP addresses will be able to trigger the function. This only applies to functions with the event_source set to 'function_url'.","type":"boolean"},"ip_whitelist":{"description":"If the function is IP restricted, the IP whitelist is the list of allowed IPv4 addresses that can trigger the function. Each entry should be a valid IPv4 IP address. Ranges are not supported. This only applies to functions with the event_source set to 'function_url'.","type":"array","items":{"type":"string","description":"A valid IPv4 address."}},"timing_options":{"type":"object","additionalProperties":false,"description":"Timing options determine when the function runs after being triggered. If not provided, the function will run immediately after being triggered. Only applies to functions with an event_source set to 'account_event'.","properties":{"timing":{"description":"The timing setting determines when the function runs after being triggered. Default is immediate. If set to 'delay', the function will run after the specified delay time has passed.","type":"string","enum":["immediate","delay"]},"time_unit":{"description":"The time unit for the delay. This is required if timing is set to 'delay'.","type":"string","enum":["minutes","hours"]},"time_value":{"description":"The time value for the delay. This is required if timing is set to 'delay'. For example, if you want the function to run 2 hours after being triggered, you would set timing to 'delay', time_unit to 'hours', and time_value to 2.","type":"integer"}}},"cron_expression":{"type":"string","description":"The cron expression that determines when the function will be triggered. Applies only to functions with an event source set to 'schedule'. The cron expression must be a valid 5 part cron expression."},"cron_timezone":{"type":"string","description":"The timezone for the cron expression. Applies only to functions with an event source set to 'schedule'. If not provided, UTC will be used. The timezone must be a valid IANA timezone string."},"custom_arguments":{"description":"A list of custom arguments which should be provided as a name value object within the custom_arguments array when triggering the Function using the TriggerFunction operation. Only available for functions with an event source set to 'api_direct'. Custom arguments are intended to be used by AI to infer values when triggering the Function. For example, if you have a custom argument with the description 'Parse the campaign ID from the sale item details.', when triggering the Function using the TriggerFunction operation, you can have AI read the custom argument description and infer a value for the custom argument based on the sale item details.","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 object when triggering a Function using the TriggerFunction operation.","type":"string"},"description":{"description":"The description of the custom argument determines what the inferred value should be when triggering the function. When triggering the Function using the TriggerFunction operation, you should: Read the custom arguments' description, then provide the inferred value when triggering the function.","type":"string"}}}},"updated_date_unix":{"description":"The unix timestamp of when the item was last updated.","type":"integer","format":"unix-time"}}}]},"type":"array"},"total_count":{"description":"The total number of items found given the date_start and date_end query parameters.","type":"integer"},"total_pages":{"description":"The total number of pages given the date_start, date_end and limit query parameters.","type":"integer"}},"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."}}}