Actions11
Overview
The "Action - Make API Call" operation in this node allows users to perform arbitrary HTTP requests against a specified API endpoint under the /api/v2/ path of a configured base URL. This is useful when you want to interact with any part of the API that may not have dedicated operations in the node or when you need full control over the request details such as method, headers, query parameters, and body.
Common scenarios include:
- Calling custom or less common API endpoints.
- Performing CRUD operations (GET, POST, PUT, DELETE) on resources exposed by the API.
- Sending complex queries or commands that require specific headers or query parameters.
- Fetching data in JSON or raw string format for further processing in workflows.
Example use case:
- You want to fetch a list of chatbot sessions with a GET request to
/api/v2/get-sessionsincluding some query parameters for filtering. - You want to update a resource by sending a PUT request with a JSON body to
/api/v2/update-resource.
Properties
| Name | Meaning |
|---|---|
| URL | The API endpoint path relative to the base URL. Must start with /api/v2/. Example: /api/v2/create-chatbot |
| Method | The HTTP method to use for the request. Options: DELETE, GET, POST, PUT |
| Headers | Custom headers to send with the request. Users can add multiple headers as name-value pairs. Authorization header is automatically added using the API key credential. |
| Query Parameters | Query parameters to include in the request URL. Multiple parameters can be added as name-value pairs. |
| Body | The JSON-formatted body of the request. Only shown and used for POST and PUT methods. Must be valid JSON. |
| Response Format | The format in which the response should be returned. Options: JSON (parsed object), String (raw stringified response) |
Output
The output of this operation is an array containing one item with a json property holding the response from the API call.
- If the response format is set to
JSON, thejsonfield contains the parsed JSON object returned by the API. - If the response format is set to
String, thejsonfield contains the entire response serialized as a JSON string.
No binary data output is produced by this operation.
Example output structure when responseFormat is json:
[
{
"json": {
"someKey": "someValue",
"anotherKey": 123
}
}
]
When responseFormat is string:
[
{
"json": "{\"someKey\":\"someValue\",\"anotherKey\":123}"
}
]
Dependencies
- Requires an API key credential with a base URL and API key for authentication.
- The base URL must be configured in the credentials and is prepended to the relative URL provided.
- The node automatically adds the
Authorization: Bearer <API_KEY>header. - The node uses n8n's built-in HTTP request helper to perform the API calls.
Troubleshooting
Error: URL must start with "/api/v2/"
This error occurs if the URL property does not begin with/api/v2/. Ensure your endpoint path starts exactly with/api/v2/.Invalid JSON body
If the body property is not valid JSON, the node will throw an error. Make sure the body content is a properly formatted JSON string.API errors returned in response
If the API returns an error status, the node throws an error with the message from the API response. Check the API documentation for the meaning of the error and verify your request parameters.Missing or incorrect credentials
The node requires a valid API key credential with a base URL. Verify that the credential is correctly configured and selected.Network or connectivity issues
If the node cannot reach the API endpoint, check network connectivity, firewall rules, and that the base URL is correct.Continue On Fail behavior
If enabled, the node will output error information in thejson.errorfield instead of stopping execution.
Links and References
- HTTP Methods — Explanation of HTTP verbs like GET, POST, PUT, DELETE.
- REST API Design — General principles of REST APIs.
- JSON Format — JSON syntax and formatting rules.
- n8n HTTP Request Documentation — Details about how HTTP requests are handled in n8n nodes.