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

# Launch Campaigns

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

### Endpoint Details

UR&#x4C;**:** `https://api.scalemate.co/api/external/v1/launch` \
Metho&#x64;**:** `POST`

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

### Parameters

<table data-header-hidden><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>file_links</code></td><td><p>Mixed (required)<br><br><code>string[]</code><br>OR</p><pre><code>{
    url, 
    title, 
    description,
    destination_url
}[]
</code></pre></td><td>List of URLs pointing to files needed for the workflow. Each link should be accessible from this endpoint.<br><br>Custom descriptions supported only for <strong>Meta Ads</strong> templates<br><br><code>url</code> - Required<br><code>title</code> - Optional<br><code>description</code> - Optional<br><code>destination_url</code> - Optional<br><br>If optional fields not passed Scalemate will use data from template</td></tr><tr><td><code>destination_url</code></td><td>string (Optional)</td><td>Valid URL to page you want to promote</td></tr><tr><td><code>template_id</code></td><td>string (Required)</td><td>Specifies the template ID to use for the workflow. It can be found at the end of the URL.</td></tr><tr><td><code>schedule_date</code></td><td>string (Optional)</td><td>Specifies the scheduled launch time for the campaign in ISO 8601 format.</td></tr><tr><td><code>max_creatives_per_adset</code></td><td>number (Optional)</td><td>Rewrites Ad set configuration max number ads</td></tr><tr><td><code>pac_rules</code></td><td>object (Optional)<br><br>stories:<br><code>string | undefined</code><br>feed:<br><code>string | undefined</code><br>search:<br><code>string | undefined</code><br><br></td><td>Defines the rules for distributing ad creatives across different placements by using Placement Asset Customization.<br><br>Supports only the following placement keys:<br><code>stories</code>, <code>feed</code>, and <code>search</code>.<br><br>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.<br><br>This field can be an empty string or entirely omitted if no customization is required for a specific placement.<br><br>Example:<br><code>{"stories": "16x9", "feed": "4x3", "search": "1x1" }</code></td></tr><tr><td><code>webhook_url</code></td><td>string (Optional)</td><td>The URL that will receive the webhook callback. Once the event is triggered, a POST request will be sent to this URL containing the relevant payload. This <strong>must</strong> be a publicly accessible HTTPS endpoint.</td></tr><tr><td><code>campaign_name_override</code></td><td>string (Optional)</td><td><p>Override campaign name created during launch. </p><p></p><p><strong>Meta Ads Only</strong></p></td></tr><tr><td><code>adset_name_override</code></td><td>string (Optional)</td><td>Override ALL ad set names created during launch. <br><br><strong>Meta Ads Only</strong></td></tr><tr><td><code>config_id</code></td><td>string (Optional)</td><td>ID of a saved <a href="https://www.scalemate.co/docs/api/configurations">Configuration</a> to overrides to the launch. <br><br>Will override the template's settings for <strong>ALL adsets</strong> created in the launch.<br><br><strong>Meta Ads Only</strong></td></tr></tbody></table>

### Example Request Body

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`, the **template\_id** is **912**.

```json
{
  "file_links": [
    "https://drive.google.com/file/d/1JbpRSvif7wR-6vwNA51A5pHcyHViSQ7d/view?usp=drive_link",
    { // Supported only for Meta Ads
      "url": "https://drive.google.com/file/d/1AkhHSkmPTZDVTeOGUvegy0gRNk-qVyaF/view?usp=drive_link",
      "title": "Custom Title",
      "description": "Custom Description"
    },
  ],  
  "template_id": "123",
  "schedule_date": "2024-12-13T12:12:00+01:00", // optional
  "max_creatives_per_adset": 1, // optional
  "destination_url": "https://q.acme.com", // optional
  "campaign_name_override": "CAMPAIGN NAME OVERRIDE", // optional
  "adset_name_override": "ADSET NAME OVERRIDE", // optional
  "config_id": "123", // optional
  "webhook_url": "https://webhook.site/your-webhook-url"
}
```

### Example cURL Request

```bash
curl --location 'https://api.scalemate.co/api/external/v1/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",
        { // Supported only for Meta Ads
            "url": "https://drive.google.com/file/d/1AkhHSkmPTZDVTeOGUvegy0gRNk-qVyaF/view?usp=drive_link",
            "title": "Custom Title",
            "description": "Custom Description"
        },
    ],
    "template_id": "123",
    "schedule_date": "2024-12-13T12:12:00+01:00",
    "max_creatives_per_adset": 1,
    "campaign_name_override": "CAMPAIGN NAME OVERRIDE",
    "adset_name_override": "ADSET NAME OVERRIDE",
    "webhook_url": "https://webhook.site/your-webhook-url"
}'
```

### Example Response

```json
{
  "job_id": "63267564-2c14-4ccc-ab60-1a61a950a25d",
  "status": "accepted",
  "message": "Launch job has been accepted and is being processed"
}
```

### Webhook Response

```json
{
  "job_id": "<JOB_ID>",
  "launch_id": "<ID>",
  "status": "success" | "failure",
  "campaigns": [
    {
      "remote_id": "<CAMPAIGN_ID>",
      "name": "<CAMPAIGN_NAME>",
      "adsets": [
        {
          "remote_id": "<ADSET_ID>",
          "name": "<ADSET_NAME>",
          "ads": [
            {
              "remote_id": "<AD_ID>",
              "name": "<FILE_NAME>",
              "bucket_url": "<FILE_URL>"
            }
          ]
        },
		    ...
      ]
    }
  ],
  "error": null,
  "completed_at": "<DATE>"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://scalemate.gitbook.io/scalemate-api/api/launch-campaigns.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
