> 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.

# Update a destination

PATCH /destinations/{platform}
Content-Type: application/json

Updates a destination's credentials, enabled state, and/or config.

Reference: https://docs.pivolio.com/api-reference/pivolio/workspaces/update-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 DestinationUpdateRequest.

- `credentials` (map from string to string, optional, nullable)
- `enabled` (boolean, optional, nullable)
- `config` (DestinationConfig, optional, nullable) — The full editable config for one destination.

## Response

### 200

Successful Response

- `id` (string, required)
- `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`
- `enabled` (boolean, required)
- `created_at` (datetime, required)
- `updated_at` (datetime, required)

## Errors

### 422 Unprocessable Entity Error

Validation Error

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

## Types

### DestinationConfig

The full editable config for one destination.

- `event_mappings` (list of EventMapping, optional)
- `consent` (ConsentConfig, optional) — When enforced, any required category the customer denied skips the send. ``when_absent`` decides the ambiguous third case — an event carrying no signal at all for a required category. It defaults to ``allow``, which is what every workspace has effectively been running under; most advertisers have not implemented Consent Mode, so defaulting to ``deny`` would stop their delivery outright with nothing but SKIPPED rows to explain it.
- `enhanced_conversions` (boolean, optional, default: false)

### FieldError

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

### EventMapping

Maps a Pivolio event name to a platform event name (with on/off). Google Ads uses the extra fields: ``conversion_action_id`` is the target action resource name; ``conversion_category`` seeds auto-created actions; ``primary`` toggles primary_for_goal (Smart Bidding).

- `source_event` (string, required)
- `destination_event` (string, required)
- `enabled` (boolean, optional, default: true)
- `conversion_action_id` (string, optional, nullable)
- `conversion_category` (string, optional, nullable)
- `primary` (boolean, optional, default: false)

### ConsentConfig

When enforced, any required category the customer denied skips the send. ``when_absent`` decides the ambiguous third case — an event carrying no signal at all for a required category. It defaults to ``allow``, which is what every workspace has effectively been running under; most advertisers have not implemented Consent Mode, so defaulting to ``deny`` would stop their delivery outright with nothing but SKIPPED rows to explain it.

- `enforce` (boolean, optional, default: true)
- `required_categories` (list of enum, optional)
  - Allowed values: `ad_user_data`, `ad_storage`, `ad_personalization`, `analytics_storage`
- `when_absent` (enum, optional) — What to do when an event carries no signal for a required consent category. The controller decides this, not the platform: some rely on a consent management platform that omits categories it has no answer for, others treat silence as refusal.
  - Allowed values: `allow`, `deny`

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": "string",
  "platform": "meta",
  "enabled": true,
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

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

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

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

print(response.json())
```

```javascript
const url = 'https://api.example.com/destinations/meta';
const options = {
  method: 'PATCH',
  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"

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

	req, _ := http.NewRequest("PATCH", 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")

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

request = Net::HTTP::Patch.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.patch("https://api.example.com/destinations/meta")
  .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('PATCH', 'https://api.example.com/destinations/meta', [
  '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");
var request = new RestRequest(Method.PATCH);
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")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```