---
title: HTTP Post
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/http/http-post
---

This page provides a comprehensive reference for http post available in the workflow automation actions catalog. These actions enable you to http post request operations.

## Prerequisites

For prerequisites, see [HTTP actions](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/http/http#prerequisites).

## Automatic request headers [#automatic-headers]

All HTTP requests performed by Workflow Automation automatically include the following headers:

| Header         | Format                                                                                                                               |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `X-Abuse-Info` | `Request sent by a New Relic WorkflowAutomation. {runId}`where `{runId}` is the workflow run ID                                      |
| `User-Agent`   | `NewRelic/WorkflowAutomation (region={region}; https://newrelic.com ; support@newrelic.com)`where `{region}` is the New Relic region |

## POST data to a server [#http-post]

Performs an HTTP POST call to send data to an API endpoint.

> #### ⚠️ IMPORTANT
>
> If you need to pass sensitive data to an input, for example an Api-Key header, you can use values stored via the [secretsManagementCreateSecret](https://onenr.io/0KQXX6BmdQa) NerdGraph mutation.
>
> **Example**
>
> ```yaml
> {
>   "inputs": [
>     {
>       "key": "headers",
>       "value": "{\"Api-Key\": \"${{ :secrets:NR_API_KEY }}\"}"
>     }
>   ]
> }
> ```

### Inputs

| Input         | Type   | Description                                                                                      |
| ------------- | ------ | ------------------------------------------------------------------------------------------------ |
| **url**       | String | **Required.** The target URL for the request. The scheme must be included: `https://example.com` |
| **urlParams** | Map    | **Optional.** The query parameters to append to the URL. Takes a stringified JSON object.        |
| **headers**   | Map    | **Optional.** The headers to add to the request. Takes a stringified JSON object.                |
| **body**      | String | **Optional.** The request body.                                                                  |
| **selectors** | List   | **Optional.** The selectors to get only the specified parameters as output.                      |

### Outputs

| Output           | Type    | Description                      |
| ---------------- | ------- | -------------------------------- |
| **responseBody** | String  | The body of the response.        |
| **statusCode**   | Int     | The status code of the response. |
| **success**      | Boolean | Status of the request.           |
| **errorMessage** | String  | Failure reason as message.       |

### Example

| Workflow definition                                                                                                                                                                                                                                                                                                                                      | Input                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Output                                                                                                                                                                                                                        |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: httpPostTest  steps:   - name: query     type: action     action: http.post     version: 1     inputs:       url: ${{ .workflowInputs.url }}       urlParams: ${{ .workflowInputs.urlParams }}       headers: ${{ .workflowInputs.headers }}       body: ${{ .workflowInputs.body }}       selectors: ${{ .workflowInputs.selectors }} ``` | ```yaml {   "inputs": [     {       "key": "url",       "value": "https://example.com"     },     {       "key": "headers",       "value": "{\"Content-Type\":\"application/json\"}"     },     {       "key": "urlParams",       "value": "{\"foo\": \"bar\"}"     },     {       "key": "body",       "value": "{\"foo\": \"bar\"}"     },     {       "key": "selectors",       "value": "[{\"name\": \"responseBody\", \"expression\": \".responseBody\"}, {\"name\": \"statusCode\", \"expression\": \".statusCode\"}]"     }   ] } ``` | ```yaml Success case:   {     "success": true     "responseBody": "",     "statusCode": 200   }  Failure case:   {     "errorMessage": "An unexpected error failed to call http post endpoint.",     "success": false   } ``` |
