post
https://api.kevel.co/v1/campaign//wallet
Links a wallet to a Campaign so the Campaign spends against the wallet's Limit.
Makes a Campaign spend from the wallet. Spend from the Campaign's Flights adds to the Balance, and the wallet's Available caps the Campaign. Keep the Id in the response. Unlinking the wallet takes it, not the wallet ID.
API syntax
POST https://api.kevel.co/v1/campaign/{CampaignID}/wallet
Before you link
- If the Campaign has already spent part of its budget, set the wallet's Limit to what is left. Spend from before the link does not count.
Rules
- The wallet must be assigned to the Campaign's Advertiser.
- A Campaign links to one wallet at a time. To replace it, use Swap Campaign Wallet.
- Several Campaigns can share a wallet.
- A Campaign with a flat-rate Flight cannot be linked to a wallet.
- The call does not check that the wallet is active or has room. A Campaign linked to an inactive wallet, or to one with no room, does not serve.
- The wallet counts spend from ads served after the link reaches serving.
Wallets on Campaign requests
POST /v1/campaign, POST /v2/campaign and PUT /v1/campaign/{CampaignID} accept a Wallets array of at most one item, such as "Wallets": [{"WalletId": 2077}].
- On create, it links the wallet.
- On update, it links the wallet if the Campaign has none, or swaps it in if the Campaign has a different one.
- Leave
Walletsout, or send an empty list, to keep the current link. To unlink, use Unlink Wallet from Campaign. - The rules above apply, and every failure returns
400. POST /v1/campaigndoes not check the rate type of Flights in the same request. Create the Campaign first and link the wallet afterwards, or usePOST /v2/campaign.
Errors
| Status | Message | What to do |
|---|---|---|
400 | Campaign is already linked to a wallet. | If it is the same wallet, there is nothing to do. Otherwise use Swap Campaign Wallet. |
400 | Wallet {id} is not mapped to the campaign advertiser. | Assign the wallet to the Campaign's Advertiser first. |
400 | The Campaign Id in the URL conflicts with the CampaignId in the request body. | Leave out CampaignId, or make it match the URL. |
400 | Cannot link wallet to campaign because the campaign has flights with a flat rate type. | Change those Flights to another rate type, or leave the Campaign without a wallet. |
404 | Wallet {id} not found. | Use one of your wallet IDs. |
404 | Campaign not found. | Use one of your Campaign IDs. |
