> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.pivolio.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.pivolio.com/_mcp/server.

# Test a destination

POST /destinations/{platform}/test
Content-Type: application/json

Sends a sample event to verify a destination's credentials, using the
provided ones or the saved ones.

Reference: https://docs.pivolio.com/api-reference/pivolio/workspaces/test-destination

## Authentication

- `X-Workspace-Id` header (required) — API Key authentication via header

## Request

### Path parameters

- `platform` (enum, required) — Ad platforms. The subset with a destination adapter is dispatchable for CAPI (incl. Reddit); the rest (e.g. x) appear only as click sources.
  - Allowed values: `meta`, `google`, `tiktok`, `linkedin`, `snapchat`, `pinterest`, `microsoft`, `reddit`, `x`

### Body (application/json)

This endpoint expects a DestinationTestRequest.

- `credentials` (map from string to string, optional, nullable)
- `test_event_code` (string, optional, nullable)

## Response

### 200

Successful Response

- `success` (boolean, required)
- `status_code` (integer, required)
- `error_code` (enum, optional, nullable) — Why a delivery failed. The HTTP status is reported separately; these classify the cause, so a caller never has to parse an error string. A skipped delivery has no error code — it did not fail, it was never sent.
  - Allowed values: `TRANSFORM_ERROR`, `TIMEOUT`, `NETWORK_ERROR`, `API_ERROR`, `AUTH_ERROR`
- `error_message` (string, optional, nullable)
- `request_id` (string, optional, nullable)
- `notes` (list of string, optional)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (string, required)
- `code` (string, required)
- `errors` (list of FieldError, optional, nullable)

## Types

### FieldError

- `field` (string, required)
- `message` (string, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "success": true,
  "status_code": 1,
  "error_code": "TRANSFORM_ERROR",
  "error_message": "string",
  "request_id": "string",
  "notes": [
    "string"
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/destinations/meta/test"

payload = {}
headers = {
    "X-Workspace-Id": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/destinations/meta/test';
const options = {
  method: 'POST',
  headers: {'X-Workspace-Id': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/destinations/meta/test"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Workspace-Id", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/destinations/meta/test")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Workspace-Id"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/destinations/meta/test")
  .header("X-Workspace-Id", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/destinations/meta/test', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Workspace-Id' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/destinations/meta/test");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Workspace-Id", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Workspace-Id": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/destinations/meta/test")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```