> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Boost Post

> Boost a post by submitting it to Facebook's ad platform

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

export const HeaderAPI = ({noProfileKey, profileKeyRequired}) => <>
    <ParamField header="Authorization" type="string" required>
      <a href="/docs/apis/overview#authorization">API Key</a> of the Primary Profile.
      <br />
      <br />
      Format: <code>Authorization: Bearer API_KEY</code>
    </ParamField>
    {!noProfileKey && (profileKeyRequired ? <ParamField header="Profile-Key" type="string" required>
          <a href="/docs/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField> : <ParamField header="Profile-Key" type="string">
          <a href="/docs/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField>)}
  </>;

<PlansAvailable plans={["premium"]} maxPackRequired={false} />

Boost an existing Facebook post to create an ad.
This endpoint allows you to convert your organic posts into paid advertisements with custom targeting, budget, and scheduling parameters.

<ul className="custom-bullets">
  <li>Budget and bid amounts must be specified in USD with up to two decimal places.</li>
  <li>The ad must run for at least 30 hours to address the Facebook requirement.</li>

  <li>
    You can use the [interests endpoint](/docs/apis/ads/facebook/get-ad-interests) to find interest IDs
    for targeting.
  </li>

  <li>Facebook may take up to 24 hours to review and approve boosted posts.</li>

  <li>
    If using `fbPostId` directly (instead of Ayrshare `postId`), ensure it's a valid Facebook post
    ID.
  </li>
</ul>

<h3 id="ad-goals">
  Ad Goals
</h3>

Each ad must have a goal. The goal determines how the ad will be optimized for display.

<ul className="custom-bullets">
  <li>
    `engagement`: This goal seeks to increase engagement while ensuring that the ad reaches the
    maximum number of unique users. It balances visibility with engagement, showing the ad to as
    many different people as possible who may interact with it.
  </li>

  <li>
    `interactions`: Designed to boost interactions, such as likes, comments, and shares, on the ad.
    Facebook prioritizes showing the ad to users most likely to engage with it.
  </li>

  <li>
    `awareness_views`: Focuses on increasing brand awareness by maximizing the number of times the
    ad is displayed. It prioritizes showing the ad as many times as possible within the budget,
    regardless of unique reach.
  </li>

  <li>
    `awareness_audience`: Aims to enhance brand awareness by maximizing the number of unique people
    who see the ad. It ensures that the ad reaches as many different users as possible and maximizes
    the unique audience size rather than showing it multiple times to the same audience.
  </li>

  <li>
    `traffic`: Sends people off Facebook to a destination you choose, such as your website, a
    landing page, or a job posting. Facebook optimizes for link clicks rather than on-platform
    engagement. This is the only goal that supports a
    [`callToAction`](/docs/apis/ads/facebook/boost-post#param-call-to-action) button.
  </li>
</ul>

Learn more about integrating the Facebook Marketing API with Ayrshare in our [Facebook Marketing API Integration Guide](https://www.ayrshare.com/blog/facebook-ads-api-boosting-with-the-marketing-api/).

## Header Parameters

<HeaderAPI />

## Body Parameters

<ParamField body="accountId" type="string" required>
  The ID of the Facebook ad account to boost the post on. The account ID can be retrieved from the
  [ad accounts endpoint](/docs/apis/ads/facebook/get-ad-accounts).
</ParamField>

<ParamField body="adName" type="string" required>
  Name for your ad (appears in Facebook Ad Manager) with the format `{adName} - {postId or fbPostId} - {current date}`.
</ParamField>

<ParamField body="bidAmount" type="number" required>
  Maximum bid amount in USD. Minimum bid amount is \$1.00.
</ParamField>

<ParamField body="budget" type="number" required>
  Daily budget in USD. Minimum budget is \$1.00.
</ParamField>

<ParamField body="fbPostId" type="string" required>
  The [Facebook social post ID](/docs/apis/overview#social-post-id) of the post to boost, which allows
  you to create an ad from a post created directly on Facebook. This is the ID of the [post on
  Facebook](/docs/apis/history/history-platform), not Ayrshare. Required if `postId` is not set.
</ParamField>

<ParamField body="goal" type="string" required default="engagement">
  The goal of the ad. Values: `engagement`, `interactions`, `awareness_views`,
  `awareness_audience`, and `traffic`. See [ad goals
  details](/docs/apis/ads/facebook/boost-post#ad-goals) above for more information.
</ParamField>

<ParamField body="locations" type="object" required default={{ countries: ["US"] }}>
  Target ad locations with an object of arrays: `countries`, `regions`, `cities`.

  <Expandable title="child attributes">
    <ParamField body="countries" type="array">
      List of country codes.

      ```json theme={"system"}
      {
        "countries": ["US", "CA"]
      }
      ```
    </ParamField>

    <ParamField body="regions" type="array">
      Regions require Facebook's region `key` value. See the [regions endpoint](/docs/apis/ads/facebook/get-ad-regions) for more information.

      ```json theme={"system"}
      {
        "regions": [{ "key": "3886" }]
      }
      ```
    </ParamField>

    <ParamField body="cities" type="array">
      Cities require: `key` (from Facebook), `radius`, and `distance_unit`.
      `radius` is the distance around the city: 10–50 miles or 17–80 kilometers.
      `distance_unit` is `mile` or `kilometer`.
      See the [cities endpoint](/docs/apis/ads/facebook/get-ad-cities) for more information.

      ```json theme={"system"}
      {
        "cities": [
          { "key": "2420605", "radius": 25, "distance_unit": "mile" }
        ]
      }
      ```
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="postId" type="string" required>
  The [Ayrshare post ID](/docs/apis/overview#ayrshare-post-id) of the post to boost. Required if
  `fbPostId` is not set.
</ParamField>

<ParamField body="status" type="string" default="active" required>
  The status of the ad. Values: `active` and `paused`.

  You can later change the status of the ad using the [update ad endpoint](/docs/apis/ads/facebook/put-ad-update).
</ParamField>

<ParamField body="adSetBudgetSharingEnabled" type="boolean" default={false}>
  Controls Meta's campaign-level ad set budget sharing.
  Meta now requires this wire field on every campaign created without a campaign-level budget, so Ayrshare always sends it — defaulting to `false` for backward compatibility.

  Set to `true` to let Meta share up to \~20% of an ad set's budget across other ad sets in the same campaign to optimize overall performance. See Meta's [ad campaign group reference](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/) for details.
</ParamField>

<ParamField body="callToAction" type="object">
  Add a call-to-action button, such as **Apply Now** or **Shop Now**, to the boosted post. The button opens the URL you supply.

  ```json theme={"system"}
  {
    "callToAction": {
      "type": "APPLY_NOW",
      "link": "https://www.mysite.com/careers/social-media-manager",
      "linkTitle": "Social Media Manager"
    }
  }
  ```

  <Expandable title="child attributes">
    <ParamField body="type" type="string" required>
      The button label. Values: `LEARN_MORE`, `APPLY_NOW`, `SIGN_UP`, `SHOP_NOW`, `BOOK_TRAVEL`,
      `GET_QUOTE`, `CONTACT_US`, `DOWNLOAD`, and `SUBSCRIBE`.

      Case-insensitive on input, so `apply_now`, `Apply_Now`, and `APPLY_NOW` are all accepted.
    </ParamField>

    <ParamField body="link" type="string" required>
      The destination the button opens. Must be an absolute `http` or `https` URL. Relative paths,
      `mailto:` links, and malformed URLs are rejected.
    </ParamField>

    <ParamField body="linkTitle" type="string">
      Optional headline displayed with the button.
    </ParamField>
  </Expandable>

  <Warning>
    `callToAction` is only supported with the `traffic` [ad goal](/docs/apis/ads/facebook/boost-post#ad-goals).
    Sending it with `engagement`, `interactions`, `awareness_views`, or `awareness_audience` returns a `400` with `code: 101` naming the compatible goals.
    Previously the value was accepted on any goal and then silently ignored, producing an ad with no button.
  </Warning>

  `callToAction.link` supplies the destination URL. When Meta renders the call to action as a button on the existing post, `urlTags` append to that button link. `goal: "traffic"` without a `callToAction` is allowed and creates a traffic ad with no button.

  The `callToAction` you send is echoed back in the boost response with `type` upper-cased — see the *Post Boosted with a Call to Action* example — and is also returned on the ad afterwards by [Get Boosted Ads](/docs/apis/ads/facebook/get-boosted-ads).
</ParamField>

<ParamField body="tracking" type="object">
  Track the ad using a Facebook Pixel.

  <Expandable title="child attributes">
    <ParamField body="pixelId" type="number" required>
      The ID of the Facebook Pixel to track the ad.

      ```json theme={"system"}
      {
       "pixelId": 1234567890
      }
      ```
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="urlTags" type="array">
  Add UTM tags to the ad URL.

  ```json theme={"system"}
  {
    "urlTags": ["utm_source=ayrshare", "utm_medium=social", "utm_campaign=ayrshare-social"]
  }
  ```

  For example if the linking URL is `https://www.mysite.com/my-post` and the URL tags added are:

  `utm_source=ayrshare`, `utm_medium=social`, and `utm_campaign=ayrshare-social`.

  The ad URL will be:
  `https://www.mysite.com/my-post?utm_source=ayrshare&utm_medium=social&utm_campaign=ayrshare-social`.
</ParamField>

<ParamField body="specialAdCategories" type="array">
  Meta requires advertisers in [special ad categories](https://www.facebook.com/business/help/298000447747885?helpref=faq_content) to must self-identify their campaign category.

  If your business is in one of these categories, you must select the appropriate category when boosting your post.

  The following values are supported:

  <ul className="custom-bullets">
    <li>
      `housing`: Ads that promote or directly link to a housing opportunity or related service,
      including but not limited to listings for the sale or rental of a home or apartment, homeowners
      insurance, mortgage insurance, mortgage loans, housing repairs and home equity or appraisal
      services.
    </li>

    <li>
      `financial_product_services`: Ads that promote or directly link to a financial products and
      services offer, including credit. `financial_products_services` is accepted as an equivalent
      spelling, and `credit` is accepted as Meta's former name for this category — all three reach
      Meta as the same category, so send whichever you already have.
    </li>

    <li>
      `employment`: Ads that promote or directly link to an employment opportunity, including but not
      limited to part- or full-time jobs, internships or professional certification programs. Related
      ads that fall within this category include promotions for job boards or fairs, aggregation
      services or ads detailing perks a company may provide, regardless of a specific job offer.
    </li>

    <li>
      `none`: The default. Declares that the campaign is not in any special ad category. Sending it
      explicitly is equivalent to omitting `specialAdCategories` altogether, and is accepted so a
      caller that always sends the field can say "no category" without special-casing it.
    </li>

    <li>
      `issues_elections_politics`: Ads made by, on behalf of, or about a candidate for public office,
      a political figure, a political party or advocating for the outcome of an election to public
      office. This also includes ads about any election, referendum or ballot initiative, including
      "Go out and vote" election campaigns. Ads regulated as political advertising or about social
      issues in any place where the ad is being placed. If selecting issues, elections, or politics,
      you must select the country in which you want to run these ads. You are required to be
      authorized to run ads about social issues, elections, or politics in the specified country.
    </li>
  </ul>

  Values are case-insensitive. An unrecognized value is rejected with a `400` and `code: 101` listing the accepted values. Previously an unrecognized value was silently dropped and the campaign was created as uncategorized, so a typo left a regulated ad running with no category declared.

  The accepted-values list in that error message is written in Meta's upper-case form and also names the alternative spellings above, so it reads `NONE, HOUSING, FINANCIAL_PRODUCTS_SERVICES, EMPLOYMENT, ISSUES_ELECTIONS_POLITICS, FINANCIAL_PRODUCT_SERVICES, CREDIT`. Those are the same five categories listed here — `FINANCIAL_PRODUCT_SERVICES` and `CREDIT` are the equivalents of `financial_product_services`, not extra categories. The identical message is returned by the [interests endpoint](/docs/apis/ads/facebook/get-ad-interests#param-special-ad-categories).

  Repeating a category, or sending two spellings of the same one such as `["credit", "financial_product_services"]`, is accepted and collapses to a single category before it reaches Meta. An empty value is rejected with a `400` and `code: 101`.

  To find interest IDs that Meta allows for one of these categories, pass the same value to the [interests endpoint](/docs/apis/ads/facebook/get-ad-interests#param-special-ad-categories).

  <Warning>
    Meta requires advertisers who have self-identified their campaign category.
    Meta uses human reviewers and machine-learning to identify these kinds of ads.
    If you send us an incorrect `specialAdCategory`, there is a risk your ads will be paused until the campaign is adjusted.
  </Warning>
</ParamField>

<ParamField body="endDate" type="string">
  End date and time in ISO 8601 format (must be at least 30 hours after start), for example `2025-03-01T00:00:00Z`.

  If not set, the ad will run indefinitely and have end date of `ongoing`.
</ParamField>

<ParamField body="excludedLocations" type="object">
  Exclude locations using an object with arrays of `countries`, `regions`, and `cities`.

  <Expandable title="child attributes">
    <ParamField body="countries" type="array">
      List of country codes to exclude.

      ```json theme={"system"}
      {
        "countries": ["US", "CA"]
      }
      ```
    </ParamField>

    <ParamField body="regions" type="array">
      Regions require Facebook's region `key` value. See the [regions endpoint](/docs/apis/ads/facebook/get-ad-regions) for more information.

      ```json theme={"system"}
      {
        "regions": [{ "key": "3886" }]
      }
      ```
    </ParamField>

    <ParamField body="cities" type="array">
      Cities require: `key` (from Facebook), `radius`, and `distance_unit`.
      `radius` is the distance around the city: 10–50 miles or 17–80 kilometers.
      `distance_unit` is `mile` or `kilometer`.
      See the [cities endpoint](/docs/apis/ads/facebook/get-ad-cities) for more information.

      ```json theme={"system"}
      {
        "cities": [
          { "key": "2420605", "radius": 25, "distance_unit": "mile" }
        ]
      }
      ```
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="gender" type="string" default="all">
  The gender of the audience. Values: `all`, `male`, `female`.
</ParamField>

<ParamField body="interests" type="array">
  The target interests of the ad as an array of Facebook [interest
  ids](/docs/apis/ads/facebook/get-ad-interests).
</ParamField>

<ParamField body="maxAge" type="number" default={65}>
  Maximum age for targeting the ad (default: 65).
</ParamField>

<ParamField body="minAge" type="number" default={18}>
  Minimum age for targeting the ad (default: 18).
</ParamField>

<ParamField body="startDate" type="string">
  Start date and time in ISO 8601 format, for example `2025-03-01T00:00:00Z`.

  If not set, the ad will start immediately.
</ParamField>

<ParamField body="dsaBeneficiary" type="string">
  The beneficiary of the ad for Digital Services Act (DSA) compliance for EU countries. Must be set
  together with `dsaPayor` if either is provided. Please refer to our [DSA
  guide](/docs/apis/ads/facebook/get-dsa-recommendations) for more information.
</ParamField>

<ParamField body="dsaPayor" type="string">
  The payor of the ad for Digital Services Act (DSA) compliance for EU countries. Must be set
  together with `dsaBeneficiary` if either is provided.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST https://api.ayrshare.com/api/ads/facebook/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]
    }'
  ```

  ```bash cURL: traffic goal with a call to action theme={"system"}
  curl -X POST https://api.ayrshare.com/api/ads/facebook/boost \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "postId": "1234567890",
      "accountId": "1234567890",
      "adName": "Nurse Practitioner Hiring",
      "status": "active",
      "goal": "traffic",
      "callToAction": {
        "type": "APPLY_NOW",
        "link": "https://example.com/careers/nurse-practitioner",
        "linkTitle": "Apply today"
      },
      "specialAdCategories": ["employment"],
      "minAge": 18,
      "maxAge": 65,
      "locations": { "countries": ["US"] },
      "budget": 100,
      "bidAmount": 1,
      "startDate": "2025-03-01T00:00:00Z",
      "endDate": "2025-03-07T23:59:59Z"
    }'
  ```

  ```javascript JavaScript theme={"system"}
  const API_KEY = "API_KEY";

  fetch("https://api.ayrshare.com/api/ads/facebook/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);
  ```

  ```python Python theme={"system"}
  import requests

  API_KEY = "API_KEY"

  url = "https://api.ayrshare.com/api/ads/facebook/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 PHP theme={"system"}
  <?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/facebook/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);
  ```

  ```csharp C# theme={"system"}
  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/facebook/boost", content);
          var responseBody = await response.Content.ReadAsStringAsync();

          Console.WriteLine(responseBody);
      }
  }
  ```

  ```go Go theme={"system"}
  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/facebook/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))
  }
  ```

  ```java Java theme={"system"}
  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/facebook/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);
          Map<String, Object> locations = new HashMap<>();
          locations.put("countries", Arrays.asList("US"));
          payload.put("locations", locations);
          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();
          }
      }
  }
  ```

  ```ruby Ruby theme={"system"}
  require 'net/http'
  require 'uri'
  require 'json'

  API_KEY = "API_KEY"

  uri = URI.parse("https://api.ayrshare.com/api/ads/facebook/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
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Post Boosted theme={"system"}
  {
      "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",
      "startDate": "2026-03-26T22:30:00Z"
  }
  ```

  ```json 200: Post Boosted with a Call to Action theme={"system"}
  {
      "status": "success",
      "adId": "120217670757750411",
      "adName": "Nurse Practitioner Hiring - DE6gpw8kxlonHy2b7Lo - 2025-03-26T23:42:43",
      "adStatus": "active",
      "bidAmount": 1,
      "budget": 100,
      "callToAction": {
          "type": "APPLY_NOW",
          "link": "https://example.com/careers/nurse-practitioner",
          "linkTitle": "Apply today"
      },
      "endDate": "2025-03-07T23:59:59Z",
      "goal": {
          "title": "Drive Traffic",
          "description": "Sends people from the boosted post to a destination off Facebook...",
          "type": "traffic"
      },
      "locations": { "countries": ["US"] },
      "maxAge": 65,
      "minAge": 18,
      "postId": "DE6gpw8kxlonHy2b7Lo",
      "startDate": "2025-03-01T00:00:00Z"
  }
  ```

  ```json 400: Invalid Account ID theme={"system"}
  {
    "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."
  }
  ```

  ```json 400: Missing Required Parameters theme={"system"}
  {
    "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: budget"
  }
  ```
</ResponseExample>
