> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trygravity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deprecated endpoints and fields

> Legacy ad unit endpoints and legacy fields that still work but have newer replacements.

These endpoints and fields still work for current integrations, but each has a newer replacement. Use the replacement in new integrations.

> [!WARNING]
>
> Ad units are the legacy creative model. They continue to work for current integrations. For new integrations, use [ad groups and ads](https://docs.trygravity.com/api-reference/advertiser/ad-groups.md). A campaign contains ad groups, and an ad group contains ads.

## Legacy fields

| Field | Where | Use instead |
| - | - | - |
| `max_cpc` | [Campaign create and update](https://docs.trygravity.com/api-reference/advertiser/campaigns.md) | Set `max_cpc` on each ad group. The campaign value is only a fallback bid for click-billed ad groups that have none. |
| `ad_unit_ids` | [Campaign create](https://docs.trygravity.com/api-reference/advertiser/campaigns.md#post-/advertiser-dashboard/campaigns) | Send `ad_groups`. |
| `daily_budget` | [Ad group create](https://docs.trygravity.com/api-reference/advertiser/ad-groups.md#post-/advertiser-dashboard/ad-groups) | A legacy stored field. Set the delivery budget on the campaign. |
| `iphone`, `android`, `desktop`, `tablet`, `mobile` | Campaign `allowed_devices` | `web`, `ios_app`, `android_app`. |

## Legacy ad unit endpoints

The endpoints below create and link ad units.

### POST `/advertiser-dashboard/ad-units`

Create an ad unit in your advertiser account. The response is `201`.

**name** `string` *required*

The ad unit name, at most 500 characters.

**headline** `string`

The headline, at most 80 characters.

**description** `string` *required*

The description.

**landing\_page** `string` *required*

The landing page URL.

**static\_ad\_text** `string` *required*

The ad text, at most 500 characters.

**static\_cta** `string` *required*

The call to action, at most 80 characters.

**favicon\_url** `string`

The favicon URL.

**image\_url** `string`

The image URL.

**brand\_name** `string`

The brand that you advertise. Users see it. Send the product or company that you advertise. Do not send an internal account, workspace, or person label. Gravity uses it as the title of the ad when there is no `headline`.

**utm\_params** `array`

UTM parameters as `{ "key": "...", "value": "..." }` pairs.

> [!NOTE]
>
> If `description`, `landing_page`, `static_ad_text`, or `static_cta` is empty, the response is `422` with the names of the empty fields. The body rejects fields that it does not know with `422`. This includes `ad_text_mode` and the fields that the server manages: `source`, `status`, `review_status`, `review_reason`, `metadata`, and `generate_static_text`.

```bash Request theme={null}
curl -X POST https://platform.trygravity.com/advertiser-dashboard/ad-units \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Summer headline variant",
    "headline": "Postgres for teams",
    "description": "Launch faster with managed Postgres.",
    "landing_page": "https://acme.com/summer",
    "static_ad_text": "Managed Postgres with built-in scaling.",
    "static_cta": "Start free",
    "brand_name": "Acme"
  }'
```

```json Response 201 theme={null}
{
  "id": "ad-123",
  "name": "Summer headline variant",
  "headline": "Postgres for teams",
  "description": "Launch faster with managed Postgres.",
  "landing_page": "https://acme.com/summer",
  "static_ad_text": "Managed Postgres with built-in scaling.",
  "static_cta": "Start free",
  "favicon_url": "https://acme.com/favicon.ico",
  "image_url": null,
  "brand_name": "Acme",
  "source": "manual",
  "status": "draft",
  "review_status": "not_submitted",
  "review_reason": null,
  "utm_params": [],
  "created_at": "2025-05-01T00:00:00",
  "updated_at": "2025-05-01T00:00:00",
  "campaign_id": null
}
```

### POST `/advertiser-dashboard/campaigns/{campaign_id}/ad-units/generate`

Make draft ad units from a landing page URL.

**campaign\_id** `string` *required*

The campaign ID.

**site\_url** `string` *required*

The landing page URL that Gravity reads. It must be an `http` or `https` URL. If it is not valid, the response is `400`.

**count** `integer` (default: 3)

The number of draft ad units to make, from 1 to 5.

If Gravity cannot make ad units from the page (for example, the page blocks automated access), the response is `422`.

```bash Request theme={null}
curl -X POST https://platform.trygravity.com/advertiser-dashboard/campaigns/camp-456/ad-units/generate \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "site_url": "https://acme.com/summer",
    "count": 3
  }'
```

```json Response theme={null}
{
  "campaign_id": "camp-456",
  "ad_units": [
    {
      "id": "ad-123",
      "name": "Managed Postgres for teams",
      "headline": "Postgres for teams",
      "description": "Launch faster with managed Postgres.",
      "landing_page": "https://acme.com/summer",
      "static_ad_text": "Managed Postgres with built-in scaling.",
      "static_cta": "Start free",
      "favicon_url": "https://acme.com/favicon.ico",
      "image_url": null,
      "brand_name": "Acme",
      "source": "scraped",
      "status": "draft",
      "review_status": "not_submitted",
      "review_reason": null,
      "utm_params": [],
      "created_at": "2025-05-01T00:00:00",
      "updated_at": "2025-05-01T00:00:00",
      "campaign_id": null
    }
  ]
}
```

### POST `/advertiser-dashboard/campaigns/{campaign_id}/ad-units`

Add ad units to a campaign. The ad units that are already linked stay linked.

**campaign\_id** `string` *required*

The campaign ID.

**ad\_unit\_ids** `array` *required*

One or more ad unit IDs. Gravity removes duplicate IDs before it writes.

The response lists all the ad units that are now linked to the campaign. Gravity marks the linked units for review when necessary. If an approved campaign now has ad units with no review, Gravity sends the campaign to review again. Then Gravity starts the ad unit sync for the campaign in the background. If an ad unit is not in your account, the response is `404`.

```bash Request theme={null}
curl -X POST https://platform.trygravity.com/advertiser-dashboard/campaigns/camp-456/ad-units \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ad_unit_ids": ["ad-123", "ad-456"]
  }'
```

```json Response theme={null}
{
  "campaign_id": "camp-456",
  "ad_unit_ids": ["ad-123", "ad-456"]
}
```

### PUT `/advertiser-dashboard/campaigns/{campaign_id}/ad-units`

Replace the set of ad units on a campaign.

> [!WARNING]
>
> This call removes each linked ad unit that is not in `ad_unit_ids`. An empty list removes all the ad units from the campaign. To add ad units and keep the current ones, use the `POST` endpoint above.

**campaign\_id** `string` *required*

The campaign ID.

**ad\_unit\_ids** `array` *required*

The new ad unit IDs. Gravity removes duplicate IDs before it writes.

This endpoint has the same ownership checks and the same review and sync behavior as the `POST` endpoint.

```bash Request theme={null}
curl -X PUT https://platform.trygravity.com/advertiser-dashboard/campaigns/camp-456/ad-units \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ad_unit_ids": ["ad-456", "ad-789"]
  }'
```

```json Response theme={null}
{
  "campaign_id": "camp-456",
  "ad_unit_ids": ["ad-456", "ad-789"]
}
```

### PATCH `/advertiser-dashboard/ad-units/{ad_unit_id}/archive`

Archive an ad unit, or restore an archived ad unit. Each call changes the archived state.

**ad\_unit\_id** `string` *required*

The ad unit ID.

When you restore an ad unit, its status changes to `"draft"`.

```bash Request theme={null}
curl -X PATCH https://platform.trygravity.com/advertiser-dashboard/ad-units/ad-123/archive \
  -H "X-API-Key: YOUR_API_KEY"
```

```json Response theme={null}
{
  "ad_unit_id": "ad-123",
  "status": "archived"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.