# Duplicate ad set

POST https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/{adSetId}/duplicate

Duplicate an existing Facebook ad set

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `adPublishing.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `adSetId` | string | Yes | Ad set identifier |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-07-28"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ad-publishing/facebook/adsets/{adSetId}/duplicate": {
      "post": {
        "summary": "Duplicate ad set",
        "operationId": "duplicateAdSet",
        "description": "Duplicate an existing Facebook ad set",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-07-28"
              ]
            }
          },
          {
            "name": "adSetId",
            "required": true,
            "in": "path",
            "description": "Ad set identifier",
            "schema": {
              "example": "507f1f77bcf86cd799439012",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LocationIdBodyDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The duplicated ad set as a new draft, with copies of its ads",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FacebookAdsetWithAdsDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "adPublishing.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "LocationIdBodyDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location identifier",
            "example": "HChooFuiyPpVYzeJ4HMe"
          }
        },
        "required": [
          "locationId"
        ],
        "title": "LocationIdBodyDTO"
      },
      "FacebookAdsetWithAdsDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Ad set identifier",
            "example": "6a323f3f4454921db1498cd8"
          },
          "name": {
            "type": "string",
            "description": "Ad set name",
            "example": "Ad set 1"
          },
          "campaignId": {
            "type": "string",
            "description": "Parent campaign id",
            "example": "6a323f3e4454921db1498ccf"
          },
          "fbAdSetId": {
            "type": "string",
            "description": "Facebook ad set id, set once published",
            "example": "120250378906150122"
          },
          "publishingStatus": {
            "type": "string",
            "description": "Publishing status. On a published entity this is not the state you asked for but the `effective_status` Meta reports, mapped back — a pause or resume re-reads it live, so an ad awaiting review comes back `IN_REVIEW` rather than `PAUSED` or `PUBLISHED`. Any effective status this service does not recognise also maps to `IN_REVIEW`.",
            "enum": [
              "DRAFT",
              "SCHEDULED",
              "PUBLISHING",
              "PUBLISHED",
              "PAUSED",
              "IN_REVIEW",
              "WITH_ISSUES",
              "REJECTED",
              "ARCHIVED",
              "FAILED"
            ],
            "example": "PUBLISHED"
          },
          "fbError": {
            "type": "string",
            "description": "Publish error from Facebook. `null` on reads when there is none.",
            "example": null,
            "nullable": true
          },
          "pageId": {
            "type": "string",
            "description": "Page the ads run under",
            "example": "196684453527082"
          },
          "instagramActorId": {
            "type": "string",
            "description": "Instagram account the ads run under. `null` when not linked.",
            "example": null,
            "nullable": true
          },
          "messagingPlatforms": {
            "description": "Messaging destinations for click-to-message ads. Empty for other conversion locations.",
            "example": [
              "MESSENGER",
              "INSTAGRAM_DIRECT"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conversionLocation": {
            "type": "string",
            "description": "Where the conversion happens",
            "example": "on_ad"
          },
          "budget": {
            "description": "Budget configuration",
            "example": {
              "budgetType": "DAILY",
              "amount": 1,
              "actualAmount": 1
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "budgetType": {
                    "type": "string",
                    "description": "Budget cadence",
                    "example": "DAILY"
                  },
                  "amount": {
                    "type": "number",
                    "description": "Budget amount as entered",
                    "example": 1
                  },
                  "actualAmount": {
                    "type": "number",
                    "description": "Amount actually applied. Differs from `amount` on connect-your-BM pricing.",
                    "example": 1
                  }
                },
                "required": [
                  "budgetType",
                  "amount"
                ],
                "title": "FacebookAdsetBudgetDTO"
              }
            ]
          },
          "audience": {
            "description": "Targeting",
            "example": {
              "genders": [
                0
              ],
              "geoLocations": [
                {
                  "key": "IN",
                  "name": "India",
                  "type": "country",
                  "selectionType": "include",
                  "radius": 17,
                  "radiusUnit": "km",
                  "geometry": {
                    "location": {
                      "lat": 20.593684,
                      "lng": 78.96288
                    },
                    "locationType": "APPROXIMATE"
                  }
                }
              ],
              "ageMin": 18,
              "ageMax": 65,
              "interests": [
                {
                  "id": "6016286626383",
                  "name": "Facebook access (mobile): tablets",
                  "type": "behaviors"
                }
              ],
              "placements": {
                "facebook": [
                  "feed",
                  "story"
                ],
                "instagram": [
                  "reels"
                ],
                "messenger": [
                  "messenger_home"
                ]
              },
              "placementType": "manual"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "genders": {
                    "description": "Genders as Facebook numeric codes, not names — `0` all, `1` male, `2` female. Empty array also means all.",
                    "example": [
                      0
                    ],
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  },
                  "geoLocations": {
                    "description": "Geographic targeting",
                    "example": [
                      {
                        "key": "IN",
                        "name": "India",
                        "type": "country",
                        "selectionType": "include",
                        "radius": 17,
                        "radiusUnit": "km",
                        "geometry": {
                          "location": {
                            "lat": 20.593684,
                            "lng": 78.96288
                          },
                          "locationType": "APPROXIMATE"
                        }
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "description": "Facebook location key",
                          "example": "IN"
                        },
                        "name": {
                          "type": "string",
                          "description": "Location display name",
                          "example": "India"
                        },
                        "type": {
                          "type": "string",
                          "description": "Location granularity",
                          "example": "country"
                        },
                        "selectionType": {
                          "type": "string",
                          "description": "Whether the location is targeted or excluded",
                          "enum": [
                            "include",
                            "exclude"
                          ],
                          "example": "include"
                        },
                        "radius": {
                          "type": "number",
                          "description": "Targeting radius. `-1` means no radius, used for country-level targeting.",
                          "example": 17
                        },
                        "radiusUnit": {
                          "type": "string",
                          "description": "Unit for the radius",
                          "enum": [
                            "km",
                            "mi"
                          ],
                          "example": "km"
                        },
                        "geometry": {
                          "description": "Geocoded coordinates, stored for address-based targeting and echoed back on reads",
                          "example": {
                            "location": {
                              "lat": 20.593684,
                              "lng": 78.96288
                            },
                            "locationType": "APPROXIMATE"
                          },
                          "allOf": [
                            {
                              "type": "object",
                              "properties": {
                                "location": {
                                  "type": "object",
                                  "description": "Geocoded centre point of the location",
                                  "example": {
                                    "lat": 20.593684,
                                    "lng": 78.96288
                                  }
                                },
                                "locationType": {
                                  "type": "string",
                                  "description": "Precision of the geocoding result",
                                  "example": "APPROXIMATE"
                                }
                              },
                              "required": [
                                "location",
                                "locationType"
                              ],
                              "title": "FacebookGeoLocationGeometryDTO"
                            }
                          ]
                        }
                      },
                      "required": [
                        "key",
                        "name",
                        "type",
                        "selectionType"
                      ],
                      "title": "FacebookGeoLocationDTO"
                    }
                  },
                  "ageMin": {
                    "type": "number",
                    "description": "Minimum age targeted",
                    "example": 18
                  },
                  "ageMax": {
                    "type": "number",
                    "description": "Maximum age targeted",
                    "example": 65
                  },
                  "interests": {
                    "description": "Interest and behaviour targeting",
                    "example": [
                      {
                        "id": "6016286626383",
                        "name": "Facebook access (mobile): tablets",
                        "type": "behaviors"
                      }
                    ],
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Facebook targeting id",
                          "example": "6016286626383"
                        },
                        "name": {
                          "type": "string",
                          "description": "Display name",
                          "example": "Facebook access (mobile): tablets"
                        },
                        "type": {
                          "type": "string",
                          "description": "Which targeting taxonomy the entry came from",
                          "example": "behaviors"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "title": "FacebookAudienceInterestDTO"
                    }
                  },
                  "placements": {
                    "type": "object",
                    "description": "Placement positions per platform. Only meaningful when `placementType` is `manual`.",
                    "additionalProperties": true,
                    "example": {
                      "facebook": [
                        "feed",
                        "story"
                      ],
                      "instagram": [
                        "reels"
                      ],
                      "messenger": [
                        "messenger_home"
                      ]
                    }
                  },
                  "placementType": {
                    "type": "string",
                    "description": "Placement strategy",
                    "enum": [
                      "auto",
                      "manual"
                    ],
                    "example": "manual"
                  }
                },
                "required": [
                  "genders",
                  "geoLocations"
                ],
                "title": "FacebookAdsetAudienceDTO"
              }
            ]
          },
          "unpublishedChanges": {
            "type": "boolean",
            "description": "Whether the ad set has edits not yet published",
            "example": false
          },
          "createdAt": {
            "type": "string",
            "description": "Created at",
            "example": "2026-06-17T06:31:27.129Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "Updated at",
            "example": "2026-08-19T11:42:35.835Z"
          },
          "ads": {
            "description": "Ads in this ad set",
            "example": [
              {
                "id": "6a323f3f4454921db1498ce1",
                "name": "Ad 1",
                "campaignId": "6a323f3e4454921db1498ccf",
                "adsetId": "6a323f3f4454921db1498cd8",
                "fbAdId": "120250378908850122",
                "publishingStatus": "PUBLISHED",
                "fbError": null,
                "mediaType": "SINGLE",
                "cta": "GET_OFFER",
                "multiAdvertiserAds": true,
                "primaryTexts": [
                  {
                    "text": "Book a free demo",
                    "_id": "6a3245204454921db1499735"
                  }
                ],
                "headlines": [
                  {
                    "text": "Book a free demo",
                    "_id": "6a3245204454921db1499735"
                  }
                ],
                "descriptions": [
                  {
                    "text": "Book a free demo",
                    "_id": "6a3245204454921db1499735"
                  }
                ],
                "primaryText": "Get an instant estimate",
                "headline": "Free home valuation",
                "description": "Fast and hassle-free",
                "media": [
                  {
                    "type": "image",
                    "src": "https://staging.files.leadconnectorhq.com/file/abc/def.jpeg",
                    "name": "creative.jpeg",
                    "_id": "6a859661867e604d24f4d73d"
                  }
                ],
                "destinationFormId": "36267736432839880",
                "destinationLink": null,
                "unpublishedChanges": false,
                "createdAt": "2026-06-17T06:31:27.661Z",
                "updatedAt": "2026-08-19T11:45:39.340Z"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Ad identifier",
                  "example": "6a323f3f4454921db1498ce1"
                },
                "name": {
                  "type": "string",
                  "description": "Ad name",
                  "example": "Ad 1"
                },
                "campaignId": {
                  "type": "string",
                  "description": "Parent campaign id",
                  "example": "6a323f3e4454921db1498ccf"
                },
                "adsetId": {
                  "type": "string",
                  "description": "Parent ad set id",
                  "example": "6a323f3f4454921db1498cd8"
                },
                "fbAdId": {
                  "type": "string",
                  "description": "Facebook ad id, set once published",
                  "example": "120250378908850122"
                },
                "publishingStatus": {
                  "type": "string",
                  "description": "Publishing status. On a published entity this is not the state you asked for but the `effective_status` Meta reports, mapped back — a pause or resume re-reads it live, so an ad awaiting review comes back `IN_REVIEW` rather than `PAUSED` or `PUBLISHED`. Any effective status this service does not recognise also maps to `IN_REVIEW`.",
                  "enum": [
                    "DRAFT",
                    "SCHEDULED",
                    "PUBLISHING",
                    "PUBLISHED",
                    "PAUSED",
                    "IN_REVIEW",
                    "WITH_ISSUES",
                    "REJECTED",
                    "ARCHIVED",
                    "FAILED"
                  ],
                  "example": "PUBLISHED"
                },
                "fbError": {
                  "type": "string",
                  "description": "Publish error from Facebook. `null` on reads when there is none.",
                  "example": null,
                  "nullable": true
                },
                "mediaType": {
                  "type": "string",
                  "description": "Creative format",
                  "example": "SINGLE"
                },
                "cta": {
                  "type": "string",
                  "description": "Call-to-action button",
                  "example": "GET_OFFER"
                },
                "multiAdvertiserAds": {
                  "type": "boolean",
                  "description": "Whether multi-advertiser ads are enabled",
                  "example": true
                },
                "primaryTexts": {
                  "description": "Primary text variants. Used by SINGLE image and video ads.",
                  "example": [
                    {
                      "text": "Book a free demo",
                      "_id": "6a3245204454921db1499735"
                    }
                  ],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "description": "Variant text. May be an empty string for an unused slot.",
                        "example": "Book a free demo"
                      },
                      "_id": {
                        "type": "string",
                        "description": "Mongo subdocument id. Note `_id`, not `id` — the transform applies to the top-level document only.",
                        "example": "6a3245204454921db1499735"
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "title": "FacebookAdTextVariantDTO"
                  }
                },
                "headlines": {
                  "description": "Headline variants",
                  "example": [
                    {
                      "text": "Book a free demo",
                      "_id": "6a3245204454921db1499735"
                    }
                  ],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "description": "Variant text. May be an empty string for an unused slot.",
                        "example": "Book a free demo"
                      },
                      "_id": {
                        "type": "string",
                        "description": "Mongo subdocument id. Note `_id`, not `id` — the transform applies to the top-level document only.",
                        "example": "6a3245204454921db1499735"
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "title": "FacebookAdTextVariantDTO"
                  }
                },
                "descriptions": {
                  "description": "Description variants",
                  "example": [
                    {
                      "text": "Book a free demo",
                      "_id": "6a3245204454921db1499735"
                    }
                  ],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "description": "Variant text. May be an empty string for an unused slot.",
                        "example": "Book a free demo"
                      },
                      "_id": {
                        "type": "string",
                        "description": "Mongo subdocument id. Note `_id`, not `id` — the transform applies to the top-level document only.",
                        "example": "6a3245204454921db1499735"
                      }
                    },
                    "required": [
                      "text"
                    ],
                    "title": "FacebookAdTextVariantDTO"
                  }
                },
                "primaryText": {
                  "type": "string",
                  "description": "Single primary text. Carried alongside `primaryTexts`, mirroring its first entry.",
                  "example": "Get an instant estimate"
                },
                "headline": {
                  "type": "string",
                  "description": "Single headline. Used by carousel ads; mirrors the first `headlines` entry otherwise.",
                  "example": "Free home valuation"
                },
                "description": {
                  "type": "string",
                  "description": "Single description",
                  "example": "Fast and hassle-free"
                },
                "media": {
                  "description": "Creative media",
                  "example": [
                    {
                      "type": "image",
                      "src": "https://staging.files.leadconnectorhq.com/file/abc/def.jpeg",
                      "name": "creative.jpeg",
                      "_id": "6a859661867e604d24f4d73d"
                    }
                  ],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "description": "Media kind",
                        "example": "image"
                      },
                      "src": {
                        "type": "string",
                        "description": "Source URL of the uploaded file",
                        "example": "https://staging.files.leadconnectorhq.com/file/abc/def.jpeg"
                      },
                      "name": {
                        "type": "string",
                        "description": "Original file name",
                        "example": "creative.jpeg"
                      },
                      "_id": {
                        "type": "string",
                        "description": "Mongo subdocument id",
                        "example": "6a859661867e604d24f4d73d"
                      }
                    },
                    "required": [
                      "type",
                      "src",
                      "name"
                    ],
                    "title": "FacebookAdMediaDTO"
                  }
                },
                "destinationFormId": {
                  "type": "string",
                  "description": "Instant form the ad routes to, when the conversion location is on-ad",
                  "example": "36267736432839880"
                },
                "destinationLink": {
                  "type": "string",
                  "description": "Click destination. `null` when the ad routes to an instant form instead.",
                  "example": null,
                  "nullable": true
                },
                "unpublishedChanges": {
                  "type": "boolean",
                  "description": "Whether the ad has edits not yet published",
                  "example": false
                },
                "createdAt": {
                  "type": "string",
                  "description": "Created at",
                  "example": "2026-06-17T06:31:27.661Z"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "Updated at",
                  "example": "2026-08-19T11:45:39.340Z"
                }
              },
              "required": [
                "id",
                "name",
                "campaignId",
                "adsetId",
                "publishingStatus",
                "mediaType",
                "multiAdvertiserAds",
                "primaryTexts",
                "headlines",
                "descriptions",
                "media",
                "createdAt",
                "updatedAt"
              ],
              "title": "FacebookAdDTO"
            }
          }
        },
        "required": [
          "id",
          "name",
          "campaignId",
          "publishingStatus",
          "pageId",
          "messagingPlatforms",
          "budget",
          "audience",
          "createdAt",
          "updatedAt",
          "ads"
        ],
        "title": "FacebookAdsetWithAdsDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for an unexpected server error",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the server failure",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "HChooFuiyPpVYzeJ4HMe"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-07-28',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "HChooFuiyPpVYzeJ4HMe"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/{adSetId}/duplicate"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-07-28"
}

payload = {
    "locationId": "HChooFuiyPpVYzeJ4HMe"
}

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

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-07-28',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "HChooFuiyPpVYzeJ4HMe"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-07-28")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"HChooFuiyPpVYzeJ4HMe\"}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate"
  payload := strings.NewReader(`{
  "locationId": "HChooFuiyPpVYzeJ4HMe"
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-07-28")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

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

url = URI("https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2021-07-28"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "HChooFuiyPpVYzeJ4HMe"
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-07-28"
}

$body = '{
  "locationId": "HChooFuiyPpVYzeJ4HMe"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ad-publishing/facebook/adsets/<adSetId>/duplicate' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
