Raw Response
Audience:
Low-code EngineersSkill Prerequisites:
APIs,Actions,Tokens
Returns content you write yourself as the response of an API endpoint, for example text, HTML, XML or JSON. You also set the HTTP status code and headers.
It ends the action list, so actions after it don't run.
The content type is text/html unless you add a Content-Type header.
Typical Use Cases
- Return a custom JSON or XML body, for example for a webhook that expects a specific format
- Return an error with a status code such as
400 Bad Requestor404 Not Found - Return a custom error body from the API's
On erroractions - Return plain text, such as
OK, or an HTML fragment
Don't use it to
- Build JSON from values you don't control. Token values aren't escaped, so a quote in a value breaks the JSON. Use New Object as JSON, Existing Object as JSON or Existing List as JSON instead.
- Return a file. Use Download File or File Response instead.
Related Actions
| Action Name | Description |
|---|---|
| New Object as JSON | Returns a JSON object built from name/value pairs. |
| Existing Object as JSON | Returns one item of a list as JSON. |
| Existing List as JSON | Returns the items of a list as a JSON array. |
| Download File | Returns a file with a file name and permission checks. |
| File Response | Returns a file by its ID, with response caching. |
Which response action should I use?
| You want to return | Use |
|---|---|
| Plain text, HTML, XML or JSON you write yourself | Raw Response |
| A JSON object built from name/value pairs | New Object as JSON |
| One item of a list as JSON | Existing Object as JSON |
| The items of a list as a JSON array | Existing List as JSON |
| A file, with a file name, permission checks and a download or preview option | Download File |
| A file by its ID, with response caching | File Response |
If no action returns a response, the API returns the text Success.
Input Parameter Reference
The parameters unique to this action are listed below. Review the common parameters for all actions here.
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| Content | The response body, for example {"status": "ok", "id": [OrderId]}. Token values are inserted as they are, without escaping. If it's empty, the body is empty. | Yes | empty string | No |
| Http code | The HTTP status code, optionally followed by a description, for example 201 or 404 Not Found. If it's empty, the status is 200. | Yes | empty string | No |
| HTTP Headers | Response headers, each with a Name and a Value, for example Content-Type = application/json. Both names and values support tokens. | Yes | empty | No |
How the response is built
- Each header is added to the response. If there's no
Content-Typeheader,Content-Type: text/htmlis added. - The status code is set from Http code. The number comes first. Anything after the first space is the status description. Without a description, the standard one is used, for example
Not Foundfor404. - The content is written as the body.
Error status codes keep your body. IIS doesn't replace it with its own error page.
If Http code isn't a number, or doesn't start with one, the response fails. The caller gets a 400 JSON error that starts with The HTTP Code should have the following format: 'number message'.
Considerations
- Set the content type. For JSON, add a
Content-Typeheader withapplication/json. For XML, useapplication/xml. For plain text, usetext/plain. Write the header name asContent-Type. Other spellings, such ascontent-type, aren't recognized, andtext/htmlis used instead. - Tokens aren't escaped. Token values are inserted into Content exactly as they are. In JSON, put text values in quotes, and make sure they can't contain quotes, backslashes or line breaks. In HTML, make sure values can't contain markup. When in doubt, use the JSON actions.
- Use it in
On error. A Raw Response in the API'sOn erroractions replaces the default error response. The[ErrorMessage]token contains the error. - Response caching. When the API has Cache Response turned on, the response is cached for the same input parameter values and returned without running the actions. The cache doesn't depend on who's calling.
- Final action. Only the first final action that runs returns the response. Use conditions to choose between several responses, for example a
404when a record isn't found and a200otherwise.
Examples
To understand how to use the below examples, please see Running Examples.
1. Return a JSON confirmation
This action returns a 201 Created status and a small JSON body with the new order's ID. The OrderId token must exist, for example from a previous Run SQL Query.
{
"Title": "Raw Response",
"ActionType": "RawResponse",
"Description": "Return the new order ID",
"Parameters": {
"Content": "{\"status\": \"created\", \"orderId\": [OrderId]}",
"HttpCode": "201 Created",
"Headers": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
2. Return 404 when a record isn't found
This action returns a 404 Not Found with a plain text message when the CustomerName token is empty. Put it before the action that returns the normal response.
{
"Title": "Raw Response",
"ActionType": "RawResponse",
"Description": "Customer not found",
"Condition": "[CustomerName] == \"\"",
"Parameters": {
"Content": "Customer [CustomerId] was not found.",
"HttpCode": "404 Not Found",
"Headers": [
{
"name": "Content-Type",
"value": "text/plain"
}
]
}
}
Revised 09/27/2026