Overview
This node provides a generic interface to interact with any REST API by specifying the resource and operation dynamically. It supports common CRUD operations such as creating, retrieving, updating, deleting, and listing multiple records from an API endpoint. This flexibility makes it ideal for integrating with APIs that do not have dedicated n8n nodes or when you want to quickly prototype API interactions without building custom nodes.
Common scenarios:
- Quickly connecting to a new or custom REST API.
- Performing standard CRUD operations on resources like users, products, orders, etc.
- Fetching all or limited sets of data with optional query parameters.
- Adding custom headers or query parameters to requests.
- Handling API timeouts and optionally continuing workflow execution on errors.
Practical example:
- Creating a new user in a CRM system by specifying the "users" resource and "create" operation with JSON data.
- Retrieving a product by ID using the "products" resource and "get" operation.
- Listing all orders with pagination control via "getAll" operation and limit parameter.
- Updating an existing record with "update" operation by providing the record ID and update data.
- Deleting a record by ID with the "delete" operation.
Properties
| Name | Meaning |
|---|---|
| Recurso (resource) | The API resource name to target (e.g., users, products, orders). |
| Operação (operation) | The action to perform on the resource. Options: create, get, getAll, update, delete. |
| Dados (data) | JSON string representing the data to create a new record (used only with create operation). |
| ID (id) | Identifier of the record to get, update, or delete (used with get, update, delete operations). |
| Retornar Todos (returnAll) | Boolean flag to return all results or limit them (used with getAll operation). |
| Limite (limit) | Maximum number of results to return when returnAll is false (used with getAll operation). |
| Dados Para Atualizar (updateData) | JSON string representing the data to update an existing record (used with update operation). |
| Opções Adicionais (additionalOptions) | Collection of additional options: |
| - Headers Customizados (headers) | JSON object of extra HTTP headers to send with the request. |
| - Query Parameters (queryParams) | JSON object of query parameters to add to the URL. |
| - Timeout (timeout) | Request timeout in milliseconds (default 30000 ms). |
| - Continuar Em Erro (continueOnFail) | Whether to continue workflow execution if an error occurs (boolean). |
Output
The node outputs an array of items where each item contains a json property holding the response data from the API call.
- For single-record responses (
get,create,update,delete), the output is a single JSON object representing the record or result. - For multi-record responses (
getAll), the output can be an array of JSON objects, each representing one record. - If the API returns an array, each element is output as a separate item paired with the input item.
- In case of errors and if
continueOnFailis enabled, the output includes an error object with message and details instead of throwing.
The node does not output binary data.
Dependencies
- Requires an API key credential configured in n8n to authenticate requests.
- Uses a helper class internally to make HTTP requests to the specified API endpoints.
- No external libraries beyond those bundled with n8n are required.
Troubleshooting
- Unknown operation error: If an unsupported operation is selected, the node throws an error indicating "Operação desconhecida". Ensure the operation is one of the supported options.
- Invalid JSON in data fields: The
dataandupdateDataproperties expect valid JSON strings. Malformed JSON will cause parsing errors. - Timeouts: Requests may fail if the API does not respond within the specified timeout. Increase the timeout value in additional options if needed.
- API authentication errors: Ensure the API key credential is correctly configured and has necessary permissions.
- Continue on fail behavior: If enabled, errors during API calls will not stop the workflow but output error details. Otherwise, errors will throw and halt execution.
Links and References
- n8n Documentation: Creating Nodes
- Generic REST API concepts: Use this node to connect to any RESTful service by specifying resource paths and HTTP methods.