---
schema_version: "1"
id: 6b670896c2045bd46afd581f5e50931f639f6046f283402f3c15c6dab36a618c
title: Platform.Function.HTTPPost()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_platformContentSyndicationHTTPPost.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformContentSyndicationHTTPPost.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 440dfd12b4bbcdfe2123f5301e7152dded6e49fe6f1736746a00eda0885245ce
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# Platform.Function.HTTPPost()

Posts content to the specified URL. This function only works with HTTP on port 80 and HTTPS on port 443. Non-standard port assignments cause this function to fail. Marketing Cloud Engagement honors any character sets specified in the `content-type` header. For example, you can use a UTF-8 encoded HTML file with `content-type: text/html; charset=utf-8` included in the header. If the header doesn’t specify the encoding, the application assumes that all returned data uses WindowsCodePage 1252 the character set. The timeout value for this function is 30 seconds.

## Syntax

```
Platform.Function.HTTPPost(1, 2, 3, 4, 5, 6)
```

## Function Properties

The function has the properties listed in this table.

| Ordinal | Type   | Description                                                           |
| ------- | ------ | --------------------------------------------------------------------- |
| `1`     | String | Required. The URL to send data to.                                    |
| `2`     | String | Required. The `content-type` header value to use in the request.      |
| `3`     | Object | Required. The payload of the POST request.                            |
| `4`     | Array  | Required. An array of header names to include in the POST request.    |
| `5`     | Array  | Required. An array of header values to include in the POST request.   |
| `6`     | Array  | Required. An array that holds the response data for the POST request. |

## Return Values

The function returns a numeric HTTP status code. For example, if the request is successfully received, the return value is `200`.

## Usage

This example sends a simple JSON object to https://example.com by issuing a POST request.

```js
<script runat="server">
  var url = "https://example.com";
  var contentTypeHeader = "application/json";
  var requestPayload = '{"name","value"}';
  var headerNames = ["header1", "header2"];
  var headerValues = ["value1", "value2"];

  var response = [0];

  try {
    var statusCode = Platform.Function.HTTPPost(
        url,
        contentTypeHeader,
        requestPayload,
        headerNames,
        headerValues,
        response
    );

    if (statusCode == 200) {
      Platform.Response.Write(response[0]);
    }
  } catch(e) {
    Platform.Response.Write(Platform.Function.Stringify(e));
  }
</script>
```

## See Also

- [HTTP.Post()](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_httpPost.md)
- [Script.Util.HttpRequest](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformContentSyndicationScriptUtilHttpRequest.md)
