Campaigns

Update a buyer (Beta)

[!CAUTION] Beta. This endpoint is still being built: more options are being added, and what it accepts may change.

Not available yet, and still set in the application:

  • Google Sheets delivery
  • Static fields
  • Ping caps and cap notifications
  • Creating or editing buyer groups (listing them and assigning a buyer to one are supported)
  • Deleting, cloning or importing a buyer
  • Testing a buyer
  • Reading back post conditions, payloads and headers (write-only)

Change a buyer: its client, its name, what it pays, or how leads are delivered to it. The body takes the same properties as creating one, under the same rules; see there for what each one means.

Only what you name changes

In the requestEffect
property left outkeeps its value, inside delivery, ping and post too
property sent as nullgoes back to its default: nickname is cleared, payload is generated again, timeout is 30
headers, recipients, post_conditions, api_responselists: replaced as a whole
response_mappingonly the keys you name change, rule by rule: {"accepted": {"value": "yes"}} keeps the stored key and condition

So a url can be changed without resending the payload or the headers, which the campaign listing never publishes.

A fixed key belongs to its condition. Switching a rule to response_has or http_status_code without a key sets the fixed one; switching away from them drops it, so the new condition needs a key of its own on a json or xml response.

Checked as it would be after the change

The stored buyer and the request are checked together, so a request can be refused for something it did not send:

  • switching response_type to json needs a complete response_mapping
  • switching the payload type, or the method to or from GET, needs a payload in the new type, or null to generate one
  • switching the method to GET also needs payload_type: form (or the stored type to be form) and headers: [], since a GET sends no headers
  • when the payload type changes and headers is not sent, the stored Content-Type header follows it
  • moving the buyer into a highest-bidder group (buyer_group_id) while real-time pricing is on for its direct post or post leg is refused; switch it off in the same request with delivery.real_time_price: false (delivery.post.real_time_price on a ping-post)

Changing the delivery type

lead_store, direct_post, ping_post, one_to_one and email can be swapped freely. Nothing carries over: the new type starts from its defaults, as creating one does, and needs what that type needs. A buyer delivered to by Google Sheets keeps its delivery: delivery is refused for it, the other properties are not.

A one-to-one buyer's buyers mapping changes key by key, like response_mapping.

Price

pricing.static changes the flat price and leaves the pricing rules set in the application as they are. It is refused while real-time pricing is on; switch that off in the same request.

Turning real-time pricing on resets the price to 0 and deletes the buyer's pricing rules, as it does in the application.

Client

Changing the client of a buyer that already received leads skews its analytics. The application recommends cloning the campaign and adding the new buyer there instead.

The paused state is not changed here; see the pause & resume endpoints. A change applies from the next lead.

patch/v2/campaigns/{campaign}/buyers/{buyer}

Request

  • Base URL: https://api.leadprosper.io/public
  • URL: https://api.leadprosper.io/public/v2/campaigns/{campaign}/buyers/{buyer}
  • Auth: one of:
    • HTTP bearer
    • API key in query parameter api_token

Path parameters

campaigninteger required

Campaign id.

buyerinteger required

Buyer id, as GET /v2/campaigns/{id} lists it.

Request body

client_idinteger

A client on the account.

nicknamestring nullable

What the buyer is called on this campaign. Falls back to the client's company when empty.

buyer_group_idinteger nullable

The buyer group to put the buyer in, from GET /v2/campaigns/{campaign}/buyer-groups. null leaves it in none. Only on a campaign that distributes by buyer groups.

Example request

{
  "client_id": 50,
  "nickname": "Acme Buyer - Direct post",
  "pricing": {
    "static": 12.5,
    "rules": [
      {
        "rules": [
          {
            "windows": [
              "mon|09:00 AM|05:00 PM|America/New_York"
            ]
          }
        ]
      }
    ],
    "bid": {
      "rules": [
        {
          "rules": [
            {
              "windows": [
                "mon|09:00 AM|05:00 PM|America/New_York"
              ]
            }
          ]
        }
      ]
    }
  },
  "api_response": [
    {
      "name": "source"
    }
  ],
  "delivery": {
    "url": "https://example.com/leads",
    "headers": [
      {
        "name": "Authorization",
        "value": "Bearer …"
      }
    ],
    "real_time_price_key": "data.price",
    "response_mapping": {
      "accepted": {
        "key": "status",
        "value": "ok"
      },
      "duplicated": {
        "key": "status",
        "value": "ok"
      }
    },
    "ping": {
      "url": "https://example.com/leads",
      "headers": [
        {
          "name": "Authorization",
          "value": "Bearer …"
        }
      ],
      "real_time_price_key": "data.price",
      "response_mapping": {
        "accepted": {
          "key": "status",
          "value": "ok"
        }
      },
      "buyers": {
        "list_key": "bids",
        "bid_id_key": "id",
        "price_key": "price",
        "tcpa_name_key": "name"
      }
    },
    "post": {
      "url": "https://example.com/leads",
      "headers": [
        {
          "name": "Authorization",
          "value": "Bearer …"
        }
      ],
      "real_time_price_key": "data.price",
      "response_mapping": {
        "accepted": {
          "key": "status",
          "value": "ok"
        },
        "duplicated": {
          "key": "status",
          "value": "ok"
        }
      },
      "buyers": {
        "list_key": "bids",
        "bid_id_key": "id"
      }
    }
  }
}

Response

Success

statusstring

Changes

No recorded changes to this operation across all 1 revision of this API.