> For the complete documentation index, see [llms.txt](https://scalemate.gitbook.io/scalemate-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scalemate.gitbook.io/scalemate-api/api/launch-campaigns-sync.md).

# Launch Campaigns (Sync)

The Launch API endpoint runs your ads through the template you've created at [Scalemate](https://www.scalemate.co/)

### Endpoint Details

**URL:** `https://api.scalemate.co/api/external/launch` \
**Method:** POST

### Request Headers

```
Content-Type: application/json
X-Api-Key: <YOUR_API_KEY>
```

You can generate the API Key at the [Settings](https://app.scalemate.co/profile) page under API Key section

| **Parameter**   | **Type**                    | **Description**                                                                                            |
| --------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `file_links`    | array of strings (Required) | List of URLs pointing to files needed for the workflow. Each link should be accessible from this endpoint. |
| `template_id`   | string (Required)           | Specifies the template ID to use for the workflow. It can be found at the end of the URL.                  |
| `schedule_date` | string (Optional)           | Specifies the scheduled launch time for the campaign in ISO 8601 format.                                   |

**Example:** `2023-10-15T14:30:00Z` or `2023-10-15T14:30:00+02:00` | | `max_creatives_per_adset` | number (Optional) | Rewrites Ad set configuration max number ads | | `pac_rules` | object (Optional)

stories: `string | undefined` feed: `string | undefined` search: `string | undefined` | Defines the rules for distributing ad creatives across different placements by using Placement Asset Customization.

Supports only the following placement keys: `stories`, `feed`, and `search`.

Each key accepts a string value that should contain part of the asset’s name to help identify which asset should be used for which placement.

This field can be an empty string or entirely omitted if no customization is required for a specific placement.

Example: `{"stories": "16x9", "feed": "4x3", "search": "1x1" }` |

### Request Body Parameters (JSON)

You can locate the template\_id at the end of the URL within the Scalemate app. For example, in the URL [`https://app.scalemate.co/workflow/builder/912`](https://app.scalemate.co/workflow/builder/912), the **template\_id** is **912**.&#x20;

### Example Request Body

```json
{
  "file_links": ["https://drive.google.com/file/d/1JbpRSvif7wR-6vwNA51A5pHcyHViSQ7d/view?usp=drive_link"],
  "template_id": "123",
  "schedule_date": "2024-12-13T12:12:00+01:00" // optional
  "max_creatives_per_adset": 1 // optional
}
```

### Example cURL Request

```bash
curl --location 'https://api.scalemate.co/api/external/launch' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <YOUR_API_KEY>' \
--data '{
    "file_links": [
        "https://drive.google.com/file/d/1JbpRSvif7wR-6vwNA51A5pHcyHViSQ7d/view?usp=drive_link"
    ],
    "template_id": "123",
    "schedule_date": "2024-12-13T12:12:00+01:00",
    "max_creatives_per_adset": 1,
}'
```

### Example Response:

```jsx
{
  "campaigns": [
    {
      "remote_id": "campaign_remote_id_1",
      "name": "Campaign Name 1",
      "adsets": [
        {
          "remote_id": "adset_remote_id_1",
          "name": "Adset Name 1",
          "ads": [
            {
              "remote_id": "ad_remote_id_1",
              "name": "Ad Name 1",
              "bucket_url": "https://example.com/video1.mp4"
            }
          ]
        },
        ...
      ]
    }
  ]
}
```
