curl -X POST https://api.ayrshare.com/api/ads/instagram/boost \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": {"countries": ["US"]},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": [1234567890, 1234567891]
}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/boost", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`
},
body: JSON.stringify({
postId: "1234567890",
accountId: "1234567890",
adName: "My Ad",
status: "active",
goal: "engagement",
minAge: 18,
maxAge: 65,
locations: { countries: ["US"] },
budget: 100,
bidAmount: 1,
startDate: "2025-03-01T00:00:00Z",
endDate: "2025-03-07T23:59:59Z",
interests: [1234567890, 1234567891]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
API_KEY = "API_KEY"
url = "https://api.ayrshare.com/api/ads/instagram/boost"
payload = {
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": {"countries": ["US"]},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": [1234567890, 1234567891]
}
response = requests.post(url, headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, json=payload)
print(response.json())
<?php
$API_KEY = "API_KEY";
$payload = [
"postId" => "1234567890",
"accountId" => "1234567890",
"adName" => "My Ad",
"status" => "active",
"goal" => "engagement",
"minAge" => 18,
"maxAge" => 65,
"locations" => ["countries" => ["US"]],
"budget" => 100,
"bidAmount" => 1,
"startDate" => "2025-03-01T00:00:00Z",
"endDate" => "2025-03-07T23:59:59Z",
"interests" => [1234567890, 1234567891]
];
$ch = curl_init("https://api.ayrshare.com/api/ads/instagram/boost");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer " . $API_KEY
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
print_r($result);
curl_close($ch);
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string API_KEY = "API_KEY";
var payload = new
{
postId = "1234567890",
accountId = "1234567890",
adName = "My Ad",
status = "active",
goal = "engagement",
minAge = 18,
maxAge = 65,
locations = new { countries = new[] { "US" } },
budget = 100,
bidAmount = 1,
startDate = "2025-03-01T00:00:00Z",
endDate = "2025-03-07T23:59:59Z",
interests = new[] { 1234567890, 1234567891 }
};
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", API_KEY);
var content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync("https://api.ayrshare.com/api/ads/instagram/boost", content);
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
apiKey := "API_KEY"
payload := map[string]interface{}{
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": map[string]interface{}{"countries": []string{"US"}},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": []int{1234567890, 1234567891},
}
jsonData, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "https://api.ayrshare.com/api/ads/instagram/boost", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
public class BoostPost {
public static void main(String[] args) {
String API_KEY = "API_KEY";
String url = "https://api.ayrshare.com/api/ads/instagram/boost";
Map<String, Object> payload = new HashMap<>();
payload.put("postId", "1234567890");
payload.put("accountId", "1234567890");
payload.put("adName", "My Ad");
payload.put("status", "active");
payload.put("goal", "engagement");
payload.put("minAge", 18);
payload.put("maxAge", 65);
payload.put("locations", Map.of("countries", Arrays.asList("US")));
payload.put("budget", 100);
payload.put("bidAmount", 1);
payload.put("startDate", "2025-03-01T00:00:00Z");
payload.put("endDate", "2025-03-07T23:59:59Z");
payload.put("interests", Arrays.asList(1234567890, 1234567891));
try {
ObjectMapper objectMapper = new ObjectMapper();
String requestBody = objectMapper.writeValueAsString(payload);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + API_KEY)
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'uri'
require 'json'
API_KEY = "API_KEY"
uri = URI.parse("https://api.ayrshare.com/api/ads/instagram/boost")
payload = {
postId: "1234567890",
accountId: "1234567890",
adName: "My Ad",
status: "active",
goal: "engagement",
minAge: 18,
maxAge: 65,
locations: { countries: ["US"] },
budget: 100,
bidAmount: 1,
startDate: "2025-03-01T00:00:00Z",
endDate: "2025-03-07T23:59:59Z",
interests: [1234567890, 1234567891]
}
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{API_KEY}"
request.body = payload.to_json
response = http.request(request)
puts response.body
{
"status": "success",
"adId": "120217670757750410",
"adName": "API Post - DE6gpw8kxlonHy2b7Lo - 2025-03-26T23:42:43",
"adStatus": "active",
"bidAmount": 10,
"budget": 100,
"endDate": "2026-03-28T22:30:00Z",
"goal": {
"title": "Get More Engagement",
"description": "This goal seeks to increase engagement...",
"type": "engagement"
},
"interests": [
"6003195554098"
],
"locations": {"countries": ["US"]},
"maxAge": 65,
"minAge": 18,
"postId": "DE6gpw8kxlonHy2b7Lo",
"socialPostId": "1234567890",
"igPostId": "1234567890",
"platform": "instagram",
"startDate": "2026-03-26T22:30:00Z"
}
{
"action": "boost post",
"status": "error",
"code": 369,
"message": "Unable to boost post. Please try again or contact us if the issue persists.",
"details": "The accountId likely does not exist. Please check the accountId and try again."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Missing required fields: accountId"
}
Instagram Ads
Boost Post
पोस्ट को Instagram के ad platform पर सबमिट करके boost करें
POST
/
ads
/
instagram
/
boost
curl -X POST https://api.ayrshare.com/api/ads/instagram/boost \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": {"countries": ["US"]},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": [1234567890, 1234567891]
}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/boost", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`
},
body: JSON.stringify({
postId: "1234567890",
accountId: "1234567890",
adName: "My Ad",
status: "active",
goal: "engagement",
minAge: 18,
maxAge: 65,
locations: { countries: ["US"] },
budget: 100,
bidAmount: 1,
startDate: "2025-03-01T00:00:00Z",
endDate: "2025-03-07T23:59:59Z",
interests: [1234567890, 1234567891]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
API_KEY = "API_KEY"
url = "https://api.ayrshare.com/api/ads/instagram/boost"
payload = {
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": {"countries": ["US"]},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": [1234567890, 1234567891]
}
response = requests.post(url, headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, json=payload)
print(response.json())
<?php
$API_KEY = "API_KEY";
$payload = [
"postId" => "1234567890",
"accountId" => "1234567890",
"adName" => "My Ad",
"status" => "active",
"goal" => "engagement",
"minAge" => 18,
"maxAge" => 65,
"locations" => ["countries" => ["US"]],
"budget" => 100,
"bidAmount" => 1,
"startDate" => "2025-03-01T00:00:00Z",
"endDate" => "2025-03-07T23:59:59Z",
"interests" => [1234567890, 1234567891]
];
$ch = curl_init("https://api.ayrshare.com/api/ads/instagram/boost");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer " . $API_KEY
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
print_r($result);
curl_close($ch);
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string API_KEY = "API_KEY";
var payload = new
{
postId = "1234567890",
accountId = "1234567890",
adName = "My Ad",
status = "active",
goal = "engagement",
minAge = 18,
maxAge = 65,
locations = new { countries = new[] { "US" } },
budget = 100,
bidAmount = 1,
startDate = "2025-03-01T00:00:00Z",
endDate = "2025-03-07T23:59:59Z",
interests = new[] { 1234567890, 1234567891 }
};
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", API_KEY);
var content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync("https://api.ayrshare.com/api/ads/instagram/boost", content);
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
apiKey := "API_KEY"
payload := map[string]interface{}{
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": map[string]interface{}{"countries": []string{"US"}},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": []int{1234567890, 1234567891},
}
jsonData, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "https://api.ayrshare.com/api/ads/instagram/boost", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
public class BoostPost {
public static void main(String[] args) {
String API_KEY = "API_KEY";
String url = "https://api.ayrshare.com/api/ads/instagram/boost";
Map<String, Object> payload = new HashMap<>();
payload.put("postId", "1234567890");
payload.put("accountId", "1234567890");
payload.put("adName", "My Ad");
payload.put("status", "active");
payload.put("goal", "engagement");
payload.put("minAge", 18);
payload.put("maxAge", 65);
payload.put("locations", Map.of("countries", Arrays.asList("US")));
payload.put("budget", 100);
payload.put("bidAmount", 1);
payload.put("startDate", "2025-03-01T00:00:00Z");
payload.put("endDate", "2025-03-07T23:59:59Z");
payload.put("interests", Arrays.asList(1234567890, 1234567891));
try {
ObjectMapper objectMapper = new ObjectMapper();
String requestBody = objectMapper.writeValueAsString(payload);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + API_KEY)
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'uri'
require 'json'
API_KEY = "API_KEY"
uri = URI.parse("https://api.ayrshare.com/api/ads/instagram/boost")
payload = {
postId: "1234567890",
accountId: "1234567890",
adName: "My Ad",
status: "active",
goal: "engagement",
minAge: 18,
maxAge: 65,
locations: { countries: ["US"] },
budget: 100,
bidAmount: 1,
startDate: "2025-03-01T00:00:00Z",
endDate: "2025-03-07T23:59:59Z",
interests: [1234567890, 1234567891]
}
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{API_KEY}"
request.body = payload.to_json
response = http.request(request)
puts response.body
{
"status": "success",
"adId": "120217670757750410",
"adName": "API Post - DE6gpw8kxlonHy2b7Lo - 2025-03-26T23:42:43",
"adStatus": "active",
"bidAmount": 10,
"budget": 100,
"endDate": "2026-03-28T22:30:00Z",
"goal": {
"title": "Get More Engagement",
"description": "This goal seeks to increase engagement...",
"type": "engagement"
},
"interests": [
"6003195554098"
],
"locations": {"countries": ["US"]},
"maxAge": 65,
"minAge": 18,
"postId": "DE6gpw8kxlonHy2b7Lo",
"socialPostId": "1234567890",
"igPostId": "1234567890",
"platform": "instagram",
"startDate": "2026-03-26T22:30:00Z"
}
{
"action": "boost post",
"status": "error",
"code": 369,
"message": "Unable to boost post. Please try again or contact us if the issue persists.",
"details": "The accountId likely does not exist. Please check the accountId and try again."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Missing required fields: accountId"
}
एक ad बनाने के लिए मौजूदा Instagram पोस्ट को boost करें।
यह endpoint आपको कस्टम targeting, बजट और scheduling parameters के साथ आपके organic पोस्ट्स को paid विज्ञापनों में परिवर्तित करने की अनुमति देता है।
उदाहरण IDs को अपनी IDs से बदलें।
- Budget और bid राशियाँ USD में अधिकतम दो दशमलव स्थानों तक निर्दिष्ट की जानी चाहिए।
- Instagram की आवश्यकता को पूरा करने के लिए ad कम से कम 30 घंटे चलना चाहिए।
- Targeting के लिए interest ID खोजने के लिए आप interests endpoint का उपयोग कर सकते हैं।
- Instagram को boosted पोस्ट्स की समीक्षा और अनुमोदन में 24 घंटे तक लग सकते हैं।
- यदि
socialPostIdका सीधे उपयोग कर रहे हैं (AyrsharepostIdके बजाय), तो सुनिश्चित करें कि यह एक वैध Instagram post ID है। - अगर Facebook द्वारा campaign बनाए जाने के बाद (creative, ad set या ad चरण पर) कोई boost विफल हो जाता है, तो हम उस campaign को हटाने की कोशिश करते हैं। अगर हटाना भी विफल हो जाता है, तो खाली campaign आपके ad account में बना रहता है। आप इसे Ads Manager में ढूंढकर हटा सकते हैं।
Ad Goals
प्रत्येक ad का एक goal होना चाहिए। Goal यह निर्धारित करता है कि ad को display के लिए किस प्रकार optimize किया जाएगा।engagement: यह goal engagement बढ़ाने का प्रयास करता है और साथ ही यह सुनिश्चित करता है कि ad अधिकतम संख्या में unique उपयोगकर्ताओं तक पहुँचे। यह visibility को engagement के साथ संतुलित करता है, ad को अधिक से अधिक विभिन्न लोगों को दिखाता है जो इसके साथ interact कर सकते हैं।interactions: ad पर interactions जैसे likes, comments, और shares को बढ़ाने के लिए डिज़ाइन किया गया। Instagram उन उपयोगकर्ताओं को ad दिखाने को प्राथमिकता देता है जिनके इसके साथ engage होने की सबसे अधिक संभावना है।awareness_views: ad को दिखाए जाने की अधिकतम संख्या के माध्यम से ब्रांड जागरूकता बढ़ाने पर केंद्रित है। यह unique reach की परवाह किए बिना, बजट के भीतर ad को अधिक से अधिक बार दिखाने को प्राथमिकता देता है।awareness_audience: ad को देखने वाले unique लोगों की संख्या को अधिकतम करके ब्रांड जागरूकता बढ़ाने का लक्ष्य रखता है। यह सुनिश्चित करता है कि ad अधिक से अधिक विभिन्न उपयोगकर्ताओं तक पहुँचे और एक ही audience को कई बार दिखाने के बजाय unique audience के आकार को अधिकतम करे।
Instagram ads के लिए Facebook के माध्यम से जुड़ा हुआ Instagram Business account, एक संबद्ध Facebook Page, और
ads_management अनुमति आवश्यक है। यह अनुमति देने के लिए Facebook के माध्यम से फिर से लिंक करें। Instagram Login से जुड़े accounts इन ads endpoints का उपयोग नहीं कर सकते। Media ID और Instagram account ID आपके linked account से resolve किए जाते हैं; instagram_user_id न भेजें।socialPostId selector Instagram-विशिष्ट alias igPostId को भी स्वीकार करता है। fbPostId केवल Facebook पर लागू होता है। सफल प्रतिक्रियाओं में platform: "instagram", socialPostId, और igPostId शामिल होते हैं।
Header Parameters
Body Parameters
string
इस boost अनुरोध के लिए एक unique, non-empty key। डुप्लिकेट ad बनने से बचने के लिए उसी payload को उसी key के साथ retry करें। किसी अलग payload या platform के साथ key का पुन: उपयोग करने पर HTTP 409 लौटाया जाता है। अभी भी प्रगति में चल रहा अनुरोध भी 409 लौटाता है; अनुपलब्ध reservation बिना कोई ad बनाए 503 लौटाता है।
boolean
डिफ़ॉल्ट:false
Meta को campaign में ad sets के बीच बजट साझा करने की अनुमति दें।
string
आवश्यक
उस Instagram ad account की ID जिस पर पोस्ट को boost करना है। Account ID को
ad accounts endpoint से प्राप्त किया जा सकता है।
string
आवश्यक
आपके ad का नाम (Instagram Ad Manager में दिखाई देता है)
{adName} - {postId or socialPostId} - {current date} फ़ॉर्मैट के साथ।number
आवश्यक
USD में अधिकतम bid राशि, अधिकतम दो दशमलव स्थानों वाली एक positive राशि के रूप में।
number
आवश्यक
USD में दैनिक बजट। अधिकतम दो दशमलव स्थानों वाली positive राशि का उपयोग करें। Meta आपके account और goal के लिए अतिरिक्त न्यूनतम सीमाएँ लागू कर सकता है।
string
Boost करने के लिए पोस्ट की Instagram social post ID, जो आपको
सीधे Instagram पर बनाए गए पोस्ट से एक ad बनाने की अनुमति देती है। यह Instagram पर पोस्ट की ID है,
Ayrshare की नहीं। यदि
postId सेट नहीं है तो आवश्यक है।string
डिफ़ॉल्ट:"engagement"
ad का goal। मान:
engagement, interactions, awareness_views, और
awareness_audience। अधिक जानकारी के लिए ऊपर ad goals details देखें।object
country codes का उपयोग करते हुए
{"countries": ["US", "CA"]} के साथ देशों को target करें। आप regions और cities arrays भी दे सकते हैं; regions और cities देखें। ऐसा object जिसमें कोई देश, क्षेत्र या शहर नहीं दिया गया हो, जैसे {}, code 101 के साथ अस्वीकार कर दिया जाता है; US को target करने के लिए locations को छोड़ दें।string
Boost करने के लिए पोस्ट की Ayrshare post ID। यदि
socialPostId सेट नहीं है तो आवश्यक है।string
डिफ़ॉल्ट:"active"
ad का status। मान:
active और paused।आप बाद में update ad endpoint का उपयोग करके ad का status बदल सकते हैं।object
Meta Pixel का उपयोग करके ad को track करें।
दिखाएं child attributes
दिखाएं child attributes
number
आवश्यक
Ad को track करने के लिए Meta Pixel की ID।
{
"pixelId": 1234567890
}
array
ad URL में UTM tags जोड़ें।उदाहरण के लिए यदि linking URL
{
"urlTags": ["utm_source=ayrshare", "utm_medium=social", "utm_campaign=ayrshare-social"]
}
https://www.mysite.com/my-post है और जोड़े गए URL tags हैं:utm_source=ayrshare, utm_medium=social, और utm_campaign=ayrshare-social।Ad URL होगा:
https://www.mysite.com/my-post?utm_source=ayrshare&utm_medium=social&utm_campaign=ayrshare-social।array
Meta special ad categories में विज्ञापनदाताओं से अपनी campaign category स्वयं-पहचान करने की आवश्यकता रखता है।यदि आपका व्यवसाय इनमें से किसी एक श्रेणी में है, तो अपनी पोस्ट को boost करते समय आपको उपयुक्त श्रेणी चुननी होगी।निम्नलिखित मान समर्थित हैं:
housing: ऐसे ads जो आवास के अवसर या संबंधित सेवा को promote करते हैं या सीधे लिंक करते हैं, जिनमें घर या अपार्टमेंट की बिक्री या किराए, homeowners insurance, mortgage insurance, mortgage loans, housing repairs और home equity या appraisal सेवाओं के लिए listings शामिल हैं, लेकिन इन्हीं तक सीमित नहीं हैं।financial_product_services: ऐसे ads जो credit सहित financial products और services offer को promote करते हैं या सीधे लिंक करते हैं।employment: ऐसे ads जो किसी employment अवसर को promote करते हैं या सीधे लिंक करते हैं, जिसमें part- या full-time jobs, internships या professional certification programs शामिल हैं, लेकिन इन्हीं तक सीमित नहीं हैं। इस श्रेणी में आने वाले संबंधित ads में किसी विशिष्ट नौकरी की पेशकश की परवाह किए बिना, job boards या fairs, aggregation services, या किसी कंपनी द्वारा प्रदान किए जा सकने वाले perks का विवरण देने वाले ads के promotions शामिल हैं।issues_elections_politics: ऐसे ads जो सार्वजनिक पद के लिए उम्मीदवार, राजनीतिक शख्सियत, राजनीतिक दल द्वारा, उनकी ओर से या उनके बारे में बनाए गए हैं या सार्वजनिक पद के लिए चुनाव के परिणाम की वकालत करते हैं। इसमें किसी भी चुनाव, referendum या ballot initiative के बारे में ads भी शामिल हैं, जिनमें “Go out and vote” चुनाव अभियान शामिल हैं। जहाँ ad रखा जा रहा है वहाँ राजनीतिक विज्ञापन के रूप में विनियमित ads या सामाजिक मुद्दों के बारे में ads। यदि issues, elections, या politics का चयन कर रहे हैं, तो आपको उस देश का चयन करना होगा जिसमें आप ये ads चलाना चाहते हैं। आपको निर्दिष्ट देश में सामाजिक मुद्दों, चुनावों, या राजनीति के बारे में ads चलाने के लिए अधिकृत होना आवश्यक है।
locations से लेता है: आपके द्वारा सूचीबद्ध देश, साथ ही हर region और city का देश। इसलिए UK के किसी city को target करने वाला housing boost आपके request में कुछ भी अतिरिक्त जोड़े बिना UK के लिए set up हो जाता है। locations के बिना ad US में चलता है, और campaign US के लिए set up होता है।Meta इन categories के लिए हर city के आसपास एक न्यूनतम radius भी तय करता है। 17 किलोमीटर radius वाले एक UK city को #2909039 के साथ अस्वीकार कर दिया गया, जो कम से कम 25 किलोमीटर (15 मील) की मांग करता है, इसलिए 25 किलोमीटर या उससे अधिक का उपयोग करें।Meta विज्ञापनदाताओं से अपनी campaign category सही ढंग से पहचानने की आवश्यकता रखता है।
Meta इस प्रकार के ads की पहचान करने के लिए मानव समीक्षकों और machine-learning का उपयोग करता है।
यदि आप हमें एक गलत
specialAdCategories भेजते हैं, तो जोखिम है कि आपके ads तब तक रोक दिए जाएंगे जब तक campaign समायोजित नहीं हो जाती।string
वह व्यक्ति या संगठन जिसे ad से लाभ होता है।
dsaPayor के साथ मिलकर सेट करें। सुझावों के लिए DSA recommendations endpoint का उपयोग करें।string
वह व्यक्ति या संगठन जो ad के लिए भुगतान करता है।
dsaBeneficiary के साथ मिलकर सेट करें।string
ISO 8601 फ़ॉर्मैट में समाप्ति तिथि और समय (start के बाद कम से कम 30 घंटे होना चाहिए), उदाहरण के लिए
2025-03-01T00:00:00Z।यदि सेट नहीं है, तो ad अनिश्चित काल तक चलेगा और उसकी end date ongoing होगी।object
locations की ही countries, regions, और cities संरचना का उपयोग करके locations को exclude करें।string
डिफ़ॉल्ट:"all"
Audience का लिंग। मान:
all, male, female।array
Instagram interest ids के array के रूप में ad के target interests।
number
डिफ़ॉल्ट:65
Ad को target करने के लिए अधिकतम आयु (डिफ़ॉल्ट: 65)।
number
डिफ़ॉल्ट:18
Ad को target करने के लिए न्यूनतम आयु (डिफ़ॉल्ट: 18)।
string
ISO 8601 फ़ॉर्मैट में प्रारंभ तिथि और समय, उदाहरण के लिए
2025-03-01T00:00:00Z।यदि सेट नहीं है, तो ad तुरंत शुरू हो जाएगा।startDate और endDate को अपने इच्छित schedule पर सेट करें; उदाहरण की तिथियाँ केवल उदाहरणस्वरूप हैं।
Campaign पर बजट
बजट को ad set के बजाय campaign पर रखने के लिए, nested form मेंbudget.level: "campaign" भेजें। तब ad set का अपना कोई बजट नहीं होता। यह daily और lifetime दोनों budgets के साथ काम करता है।
{
"accountId": "123456789",
"postId": "Ut1fWU6XkqkMayHGnJZ",
"goal": "engagement",
"budget": { "amount": 50, "type": "lifetime", "level": "campaign" },
"schedule": { "start": "2026-11-01T00:00:00Z", "end": "2026-11-08T00:00:00Z" },
"platformOptions": { "instagram": { "adName": "November boost", "bidAmount": 2 } }
}
budget.level:adSet(डिफ़ॉल्ट) याcampaign। campaign budget कोadSetBudgetSharingEnabledके साथ नहीं जोड़ा जा सकता। दोनों भेजने पर अनुरोध400औरcode: 101के साथ अस्वीकार कर दिया जाता है।- campaign budget के लिए response में
budgetLevel: "campaign"जुड़ता है। ad set budgetbudgetLevelनहीं लौटाता, इसलिए अनुपस्थित field कोadSetमानें। - History में, daily campaign budget वाले ad के लिए
budgetDailycampaign का daily budget दिखाता है। यदि कई ads एक ही campaign budget साझा करते हैं, तो हर ad अपना हिस्सा नहीं, बल्कि पूरा campaign budget दिखाता है। History lifetime budgets नहीं दिखाता, न campaign पर और न ad set पर। lifetime campaign budget खर्च हो जाने पर, अगले nightly update के बाद उस campaign का हर addeliveryStatus: "COMPLETED"दिखाता है, जिसमें scheduled या review में मौजूद ad भी शामिल है। rejected adREJECTEDही रहता है।
किसी मौजूदा campaign या ad set में boost करें
डिफ़ॉल्ट रूप से हर boost अपना campaign, ad set और ad बनाता है। boost को Meta में पहले से चल रहे अपने किसी campaign या ad set में जोड़ने के लिए,attachTo के साथ nested form भेजें।
attachTo.campaignId: boost उस campaign के अंदर एक नया ad set और ad बनाता है।budget,targetingऔरbidAmountसामान्य रूप से भेजें: ये नए ad set पर लागू होते हैं।attachTo.adSetId: boost उस ad set के अंदर केवल ad बनाता है। साथ मेंattachTo.campaignIdभी भेजें, यानी वह campaign जिससे ad set संबंधित है।budget,targetingऔरplatformOptions.instagram.bidAmountन भेजें: ad set अपने ही मान रखता है। इनमें से कोई भी भेजने परcode: 101के साथ400लौटता है।
{
"accountId": "123456789",
"postId": "Ut1fWU6XkqkMayHGnJZ",
"goal": "engagement",
"attachTo": { "campaignId": "120210000000000001", "adSetId": "120210000000000002" },
"platformOptions": { "instagram": { "adName": "November boost" } }
}
- campaign या ad set उसी ad account में होना चाहिए जिसकी ID
accountIdमें दी गई है, और वह किसी अन्य उपयोगकर्ता के boosts का नहीं होना चाहिए। अन्यथा अनुरोध400लौटाता है। कोई Instagram boost ऐसे campaign से भी नहीं जुड़ सकता जिसे किसी Facebook boost ने बनाया हो, और इसका उलटा भी लागू होता है। attachToकोbudget.level: "campaign",specialAdCategoriesयाadSetBudgetSharingEnabledके साथ नहीं जोड़ा जा सकता, क्योंकि ये नए campaign पर सेट होते हैं। इन्हें भेजने परcode: 101लौटता है।- boost को रोकने या सक्रिय करने से केवल वही बदलता है जो boost ने बनाया था: ad, और ad set यदि उसे boost ने बनाया था।
attachToमें आपके द्वारा दिया गया campaign या ad set अपना status बनाए रखता है। ad केवल तभी चलता है जब उसके ऊपर का campaign और ad set सक्रिय हों। यह तब भी लागू होता है जब Ayrshare आपके ads रोकता है, उदाहरण के लिए जब कोई profile हटाई जाती है। - यदि boost विफल हो जाता है, तो
attachToमें दिया गया campaign या ad set कभी नहीं हटाया जाता। - यदि आप जिस ad set से जोड़ते हैं वह ऐसे campaign में है जिसके पास बजट है (campaign budget), तो History boost को campaign budget वाले किसी भी ad की तरह रिपोर्ट करता है:
budgetDailyboost का हिस्सा नहीं, बल्कि पूरा campaign budget दिखाता है, और lifetime campaign budget खर्च हो जाने पर, अगले nightly update के बाद उस campaign में Ayrshare द्वारा ट्रैक किया गया हर addeliveryStatus: "COMPLETED"दिखाता है, जिसमें scheduled या review में मौजूद ad भी शामिल है। rejected adREJECTEDही रहता है।
curl -X POST https://api.ayrshare.com/api/ads/instagram/boost \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": {"countries": ["US"]},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": [1234567890, 1234567891]
}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/boost", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${API_KEY}`
},
body: JSON.stringify({
postId: "1234567890",
accountId: "1234567890",
adName: "My Ad",
status: "active",
goal: "engagement",
minAge: 18,
maxAge: 65,
locations: { countries: ["US"] },
budget: 100,
bidAmount: 1,
startDate: "2025-03-01T00:00:00Z",
endDate: "2025-03-07T23:59:59Z",
interests: [1234567890, 1234567891]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
API_KEY = "API_KEY"
url = "https://api.ayrshare.com/api/ads/instagram/boost"
payload = {
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": {"countries": ["US"]},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": [1234567890, 1234567891]
}
response = requests.post(url, headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}, json=payload)
print(response.json())
<?php
$API_KEY = "API_KEY";
$payload = [
"postId" => "1234567890",
"accountId" => "1234567890",
"adName" => "My Ad",
"status" => "active",
"goal" => "engagement",
"minAge" => 18,
"maxAge" => 65,
"locations" => ["countries" => ["US"]],
"budget" => 100,
"bidAmount" => 1,
"startDate" => "2025-03-01T00:00:00Z",
"endDate" => "2025-03-07T23:59:59Z",
"interests" => [1234567890, 1234567891]
];
$ch = curl_init("https://api.ayrshare.com/api/ads/instagram/boost");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer " . $API_KEY
]);
$response = curl_exec($ch);
$result = json_decode($response, true);
print_r($result);
curl_close($ch);
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string API_KEY = "API_KEY";
var payload = new
{
postId = "1234567890",
accountId = "1234567890",
adName = "My Ad",
status = "active",
goal = "engagement",
minAge = 18,
maxAge = 65,
locations = new { countries = new[] { "US" } },
budget = 100,
bidAmount = 1,
startDate = "2025-03-01T00:00:00Z",
endDate = "2025-03-07T23:59:59Z",
interests = new[] { 1234567890, 1234567891 }
};
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", API_KEY);
var content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8,
"application/json"
);
var response = await client.PostAsync("https://api.ayrshare.com/api/ads/instagram/boost", content);
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
apiKey := "API_KEY"
payload := map[string]interface{}{
"postId": "1234567890",
"accountId": "1234567890",
"adName": "My Ad",
"status": "active",
"goal": "engagement",
"minAge": 18,
"maxAge": 65,
"locations": map[string]interface{}{"countries": []string{"US"}},
"budget": 100,
"bidAmount": 1,
"startDate": "2025-03-01T00:00:00Z",
"endDate": "2025-03-07T23:59:59Z",
"interests": []int{1234567890, 1234567891},
}
jsonData, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "https://api.ayrshare.com/api/ads/instagram/boost", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+apiKey)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;
public class BoostPost {
public static void main(String[] args) {
String API_KEY = "API_KEY";
String url = "https://api.ayrshare.com/api/ads/instagram/boost";
Map<String, Object> payload = new HashMap<>();
payload.put("postId", "1234567890");
payload.put("accountId", "1234567890");
payload.put("adName", "My Ad");
payload.put("status", "active");
payload.put("goal", "engagement");
payload.put("minAge", 18);
payload.put("maxAge", 65);
payload.put("locations", Map.of("countries", Arrays.asList("US")));
payload.put("budget", 100);
payload.put("bidAmount", 1);
payload.put("startDate", "2025-03-01T00:00:00Z");
payload.put("endDate", "2025-03-07T23:59:59Z");
payload.put("interests", Arrays.asList(1234567890, 1234567891));
try {
ObjectMapper objectMapper = new ObjectMapper();
String requestBody = objectMapper.writeValueAsString(payload);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + API_KEY)
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
require 'net/http'
require 'uri'
require 'json'
API_KEY = "API_KEY"
uri = URI.parse("https://api.ayrshare.com/api/ads/instagram/boost")
payload = {
postId: "1234567890",
accountId: "1234567890",
adName: "My Ad",
status: "active",
goal: "engagement",
minAge: 18,
maxAge: 65,
locations: { countries: ["US"] },
budget: 100,
bidAmount: 1,
startDate: "2025-03-01T00:00:00Z",
endDate: "2025-03-07T23:59:59Z",
interests: [1234567890, 1234567891]
}
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{API_KEY}"
request.body = payload.to_json
response = http.request(request)
puts response.body
{
"status": "success",
"adId": "120217670757750410",
"adName": "API Post - DE6gpw8kxlonHy2b7Lo - 2025-03-26T23:42:43",
"adStatus": "active",
"bidAmount": 10,
"budget": 100,
"endDate": "2026-03-28T22:30:00Z",
"goal": {
"title": "Get More Engagement",
"description": "This goal seeks to increase engagement...",
"type": "engagement"
},
"interests": [
"6003195554098"
],
"locations": {"countries": ["US"]},
"maxAge": 65,
"minAge": 18,
"postId": "DE6gpw8kxlonHy2b7Lo",
"socialPostId": "1234567890",
"igPostId": "1234567890",
"platform": "instagram",
"startDate": "2026-03-26T22:30:00Z"
}
{
"action": "boost post",
"status": "error",
"code": 369,
"message": "Unable to boost post. Please try again or contact us if the issue persists.",
"details": "The accountId likely does not exist. Please check the accountId and try again."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "Missing required fields: accountId"
}