Skip to main content
Create or update a Facebook ad (v2)
PUT https://services.leadconnectorhq.com/ad-publishing/facebook/ads-v2

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

id
string
default:"ad_123"
Ad identifier
locationId
string
default:"loc_abc123"
required
Account identifier
name
string
default:"My Ad Creative"
Ad name
primaryText
string
default:"Check out our offer!"
Ad primary text
headline
string
default:"Great Deal"
Ad headline text
description
string
default:"Limited time offer"
Ad description text
imageUrl
string
default:"https://example.com/img.jpg"
Ad image URL
mediaType
string
Ad media type Posibles valores: ‘SINGLE’, ‘CAROUSEL’
media
object[]
Media items (images or videos) attached to the ad creative
multiAdvertiserAds
boolean
default:"False"
Enable multi-advertiser ads
campaignId
string
default:"camp_123"
required
Parent campaign ID
adsetId
string
default:"adset_123"
required
Parent ad set ID
cta
string
default:"LEARN_MORE"
Call to action type
conversationFormId
string
default:"conv_123"
Conversation form ID
Destination link URL
destinationFormId
string
default:"form_123"
Destination form ID

Respuestas

{}
{}
{}

Ejemplo

curl -X PUT 'https://services.leadconnectorhq.com/ad-publishing/facebook/ads-v2' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "ad_123",
  "locationId": "loc_abc123",
  "name": "My Ad Creative",
  "primaryText": "Check out our offer!",
  "headline": "Great Deal",
  "description": "Limited time offer",
  "imageUrl": "https://example.com/img.jpg",
  "mediaType": "SINGLE",
  "media": [
    {
      "src": "https://example.com/image.jpg",
      "thumbnailUrl": "https://example.com/thumb.jpg",
      "selectedPoster": 0,
      "type": "IMAGE",
      "name": "ad_image.jpg"
    }
  ],
  "multiAdvertiserAds": false,
  "campaignId": "camp_123",
  "adsetId": "adset_123",
  "cta": "LEARN_MORE",
  "conversationFormId": "conv_123",
  "destinationLink": "https://example.com",
  "destinationFormId": "form_123"
}'
const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/ads-v2', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id": "ad_123", "locationId": "loc_abc123", "name": "My Ad Creative", "primaryText": "Check out our offer!", "headline": "Great Deal", "description": "Limited time offer", "imageUrl": "https://example.com/img.jpg", "mediaType": "SINGLE", "media": [{"src": "https://example.com/image.jpg", "thumbnailUrl": "https://example.com/thumb.jpg", "selectedPoster": 0, "type": "IMAGE", "name": "ad_image.jpg"}], "multiAdvertiserAds": false, "campaignId": "camp_123", "adsetId": "adset_123", "cta": "LEARN_MORE", "conversationFormId": "conv_123", "destinationLink": "https://example.com", "destinationFormId": "form_123"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'PUT',
    'https://services.leadconnectorhq.com/ad-publishing/facebook/ads-v2',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"id": "ad_123", "locationId": "loc_abc123", "name": "My Ad Creative", "primaryText": "Check out our offer!", "headline": "Great Deal", "description": "Limited time offer", "imageUrl": "https://example.com/img.jpg", "mediaType": "SINGLE", "media": [{"src": "https://example.com/image.jpg", "thumbnailUrl": "https://example.com/thumb.jpg", "selectedPoster": 0, "type": "IMAGE", "name": "ad_image.jpg"}], "multiAdvertiserAds": false, "campaignId": "camp_123", "adsetId": "adset_123", "cta": "LEARN_MORE", "conversationFormId": "conv_123", "destinationLink": "https://example.com", "destinationFormId": "form_123"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/ad-publishing/facebook/ads-v2');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode({'id': 'ad_123', 'locationId': 'loc_abc123', 'name': 'My Ad Creative', 'primaryText': 'Check out our offer!', 'headline': 'Great Deal', 'description': 'Limited time offer', 'imageUrl': 'https://example.com/img.jpg', 'mediaType': 'SINGLE', 'media': [{'src': 'https://example.com/image.jpg', 'thumbnailUrl': 'https://example.com/thumb.jpg', 'selectedPoster': 0, 'type': 'IMAGE', 'name': 'ad_image.jpg'}], 'multiAdvertiserAds': false, 'campaignId': 'camp_123', 'adsetId': 'adset_123', 'cta': 'LEARN_MORE', 'conversationFormId': 'conv_123', 'destinationLink': 'https://example.com', 'destinationFormId': 'form_123'}),
]);
$data = json_decode(curl_exec($ch), true);