Link Wallet to Campaign

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 Wallets out, 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/campaign does not check the rate type of Flights in the same request. Create the Campaign first and link the wallet afterwards, or use POST /v2/campaign.

Errors

StatusMessageWhat to do
400Campaign is already linked to a wallet.If it is the same wallet, there is nothing to do. Otherwise use Swap Campaign Wallet.
400Wallet {id} is not mapped to the campaign advertiser.Assign the wallet to the Campaign's Advertiser first.
400The Campaign Id in the URL conflicts with the CampaignId in the request body.Leave out CampaignId, or make it match the URL.
400Cannot 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.
404Wallet {id} not found.Use one of your wallet IDs.
404Campaign not found.Use one of your Campaign IDs.
Path Params
integer
required

The Campaign's ID.

Body Params
integer
required

The wallet to link. It must be assigned to the Campaign's Advertiser.

integer
Defaults to 0

Optional. Leave it out. It defaults to 0.

integer

Optional. If you send it, it must match the Campaign in the URL.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Choose an example:
application/json