# Create ads

Create a Sponsored Products, Sponsored Brands or Sponsored Display campaign with its ad group, ads and keywords or targets in one call.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

`POST /v1/ads/create` creates the campaign, its ad group, the ads and their keywords or targets in one call. `platformSpecificData.adProduct` picks the ad product, and its other keys carry what the unified fields do not.

## Create a campaign

This creates a manual Sponsored Products campaign for one ASIN, with two keywords and a negative keyword.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: created } = await zernio.adcampaigns.createStandaloneAd({
  body: {
    accountId: '66b2e19d8c3f5a7e9d0b1c2d',
    adAccountId: '3245678901234567',
    name: 'Trail bottle launch',
    goal: 'conversions',
    budgetAmount: 20,
    budgetType: 'daily',
    keywords: ['insulated water bottle', { text: 'trail bottle', matchType: 'exact' }],
    negativeKeywords: [{ text: 'cheap', matchType: 'phrase' }],
    platformSpecificData: {
      adProduct: 'SPONSORED_PRODUCTS',
      targetingType: 'MANUAL',
      biddingStrategy: 'AUTO_FOR_SALES',
      defaultBid: 0.75,
      asins: ['B0C1234567']
    }
  }
});

console.log(created.ad.id);
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

created = client.ad_campaigns.create_standalone_ad(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    ad_account_id="3245678901234567",
    name="Trail bottle launch",
    goal="conversions",
    budget_amount=20,
    budget_type="daily",
    keywords=["insulated water bottle", {"text": "trail bottle", "matchType": "exact"}],
    negative_keywords=[{"text": "cheap", "matchType": "phrase"}],
    platform_specific_data={
        "adProduct": "SPONSORED_PRODUCTS",
        "targetingType": "MANUAL",
        "biddingStrategy": "AUTO_FOR_SALES",
        "defaultBid": 0.75,
        "asins": ["B0C1234567"],
    },
)

print(created["ad"]["id"])
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/ads/create" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "adAccountId": "3245678901234567",
    "name": "Trail bottle launch",
    "goal": "conversions",
    "budgetAmount": 20,
    "budgetType": "daily",
    "keywords": ["insulated water bottle", { "text": "trail bottle", "matchType": "exact" }],
    "negativeKeywords": [{ "text": "cheap", "matchType": "phrase" }],
    "platformSpecificData": {
      "adProduct": "SPONSORED_PRODUCTS",
      "targetingType": "MANUAL",
      "biddingStrategy": "AUTO_FOR_SALES",
      "defaultBid": 0.75,
      "asins": ["B0C1234567"]
    }
  }'
```
</Tab>
</Tabs>

Response (`201`), trimmed:

```json
{
  "ad": {
    "id": "6ae0968fa23091cc35b72199",
    "name": "Trail bottle launch",
    "platform": "amazon",
    "adType": "standalone",
    "goal": "conversions",
    "budget": { "amount": 20, "type": "daily" },
    "platformAdId": "281734567890123",
    "platformCampaignId": "190345678901234",
    "platformAdSetId": "205678901234567",
    "platformAdAccountId": "3245678901234567"
  }
}
```

`adAccountId` is the Amazon profile id from [Connect](/platforms/amazon-ads/connect#list-the-ad-accounts). Every sample on the Amazon Ads pages reuses the `zernio` and `client` constructors from this one.

## Ad products

| `adProduct` | Settings in `platformSpecificData` | Goals (`goal`) |
|-------------|------------------------------------|----------------|
| `SPONSORED_PRODUCTS` | `targetingType` (`MANUAL` or `AUTO`), `asins` (vendors) or `skus` (sellers), `defaultBid`, `biddingStrategy`, `placementBidding`, `productTargets`, `negativeProductTargets`, `autoTargeting` | `conversions` |
| `SPONSORED_BRANDS` | `brandEntityId`, `ad` (`manualCollection`, `storeSpotlight` or `video`), `defaultBid`, `bidOptimization`, `placementAdjustments`, `productTargets`, `negativeProductTargets` | `traffic`, `awareness`, `video_views`, `conversions` |
| `SPONSORED_DISPLAY` | `tactic` (`T00020` products and categories, `T00030` also audiences), `asins` or `skus`, `defaultBid`, `targets`, `negativeTargets` | `traffic`, `conversions`, `awareness` |

Sponsored Brands creative assets (logo, video) are Creative Asset Library ids. `portfolioId` places a campaign in a portfolio on all three.

## How it behaves

- `budgetAmount` is in whole units of the profile's currency. Sponsored Brands also takes a lifetime budget; the other two take a daily one.
- `keywords` and `negativeKeywords` apply to Sponsored Products and Sponsored Brands, and `campaignNegativeKeywords` to Sponsored Products.
- A keyword or target with its own `bid` overrides `defaultBid`.
- `POST /v1/ads/campaigns` creates the campaign alone, with its budget and the campaign keys of `platformSpecificData`. `existingCampaignId` then adds an ad group to it, and `adSetId` adds ads to an existing ad group.
- If a step after the campaign fails, Zernio archives the campaign it created and the error names the refused item, such as `keywords[2]`.
- Amazon reviews Sponsored Brands and Sponsored Display ads: an ad serves once approved.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `400` on `platformSpecificData` | It is missing, has an unknown key, or uses `asins` on a seller profile (or `skus` on a vendor one) | Send `adProduct` and only the keys of that product. |
| `400` on a creative or audience field | `headline`, `body`, `linkUrl`, `imageUrl`, `countries` or `interests` sent | Leave them out: Amazon ads are built from your products. |
| `422` on `goal` | A goal the ad product does not take | Use a goal from the table above. |
| `501` with code `feature_not_available` | `validateOnly` sent | Amazon has no dry run: create the campaign paused instead. |

## Related

- [Create standalone ad](/ad-campaigns/create-standalone-ad): every field of the request.
- [Targeting](/platforms/amazon-ads/targeting): product, category, automatic and audience targets.
- [Keywords](/platforms/amazon-ads/keywords): keywords and negative keywords.
- [Manage ads](/platforms/amazon-ads/manage-ads): pause, resume, rebudget and archive.