> ## 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.

# Konten

> Instagram-Werbekonten abrufen

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} />

Rufen Sie verfügbare Facebook-Werbekonten ab, die mit dem authentifizierten Profil verknüpft sind.
Dieser Endpunkt ermöglicht Ihnen den Zugriff auf grundlegende Kontoinformationen sowie wichtige Kennzahlen der Werbekonten.

<ul className="custom-bullets">
  <li>
    Das `metrics`-Objekt enthält aggregierte Performance-Daten über alle Anzeigen im
    Konto hinweg.
  </li>

  <li>
    Ergebnisse werden 10 Minuten zwischengespeichert, um die Leistung zu optimieren und die Anzahl der API-
    Aufrufe an Instagram zu reduzieren.
  </li>

  <li>
    Der Kontostatus in der JSON-Antwort kann einer der folgenden Werte sein: `active`, `disabled`, `unsettled`, `pending_risk_review`, `pending_settlement`, `in_grace_period`, `pending_closure`, `closed`, `any_active` oder `any_closed`.
  </li>
</ul>

<Note>
  Diese Endpunkte erfordern ein Instagram-Business-Konto, das über Facebook mit der Berechtigung zur Anzeigenverwaltung verbunden ist. Verknüpfen Sie das Konto erneut über Facebook, wenn diese Berechtigung fehlt. Instagram Login wird nicht unterstützt. Meta-Werbekonten können Anzeigen sowohl für Facebook als auch für Instagram enthalten; die Kontoliste ist keine reine Instagram-Liste. Übermittelte Anzeigen und der Verlauf sind auf Instagram beschränkt.
</Note>

Verwenden Sie `facebook` oder `instagram` in der Ads-URL. Andere Plattformwerte geben HTTP 400 mit `code: 101` zurück.

## Header-Parameter

<HeaderAPI />

## Query-Parameter

<ParamField query="limit" type="number" default={100}>
  Begrenzt die Anzahl der zurückgegebenen Werbekonten.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -X GET https://api.ayrshare.com/api/ads/instagram/accounts
  ```

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

  fetch("https://api.ayrshare.com/api/ads/instagram/accounts", {
        method: "GET",
        headers: {
          "Authorization": `Bearer ${API_KEY}`
        }
      })
        .then((res) => res.json())
        .then((json) => console.log(json))
        .catch(console.error);
  ```

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

  headers = {'Authorization': 'Bearer API_KEY'}

  r = requests.get('https://api.ayrshare.com/api/ads/instagram/accounts', headers=headers)

  print(r.json())
  ```

  ```php PHP theme={"system"}
  <?php
  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.ayrshare.com/api/ads/instagram/accounts",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
      "Authorization: Bearer API_KEY"
    ]
  ]);

  $response = curl_exec($curl);
  curl_close($curl);

  echo $response;
  ?>
  ```

  ```csharp C# theme={"system"}
  using System;
  using System.Net.Http;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main(string[] args)
      {
          string apiKey = "API_KEY";

          using (HttpClient client = new HttpClient())
          {
              client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");

              HttpResponseMessage response = await client.GetAsync("https://api.ayrshare.com/api/ads/instagram/accounts");
              string content = await response.Content.ReadAsStringAsync();

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

  ```go Go theme={"system"}
  package main

  import (
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      apiKey := "API_KEY"

      req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/instagram/accounts", nil)
      req.Header.Add("Authorization", "Bearer " + apiKey)

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          fmt.Println(err)
          return
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={"system"}
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;

  public class GetAdAccounts {
      public static void main(String[] args) {
          try {
              String apiKey = "API_KEY";

              URL url = new URL("https://api.ayrshare.com/api/ads/instagram/accounts");
              HttpURLConnection conn = (HttpURLConnection) url.openConnection();
              conn.setRequestMethod("GET");
              conn.setRequestProperty("Authorization", "Bearer " + apiKey);

              BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
              String inputLine;
              StringBuffer response = new StringBuffer();

              while ((inputLine = in.readLine()) != null) {
                  response.append(inputLine);
              }
              in.close();

              System.out.println(response.toString());
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  ```

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

  uri = URI('https://api.ayrshare.com/api/ads/instagram/accounts')
  req = Net::HTTP::Get.new(uri)
  req['Authorization'] = 'Bearer API_KEY'

  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http|
    http.request(req)
  }

  puts response.body
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Erfolg theme={"system"}
  {
      "status": "success",
      "adAccounts": [
          {
              "accountId": "274948345",
              "ageInDays": 2870.86,
              "amountSpent": 191.33,
              "balance": 7.84,
              "budgetRemaining": 1,
              "business": {
                  "name": "Fun Fun Fun",
                  "city": "New York",
                  "country": "US",
                  "state": "NY",
                  "street": "178 Columbus Ave",
                  "zip": "10023"
              },
              "created": "2012-01-05T03:11:31-0800",
              "currency": "USD",
              "disableReason": null,
              "fundingSource": {
                  "id": "13157487252022",
                  "type": "Credit Card"
              },
              "hasNotificationsEnabled": true,
              "isPersonal": false,
              "isPrepayAccount": false,
              "metrics": {
                  "spend": 191.33,
                  "impressions": 24994,
                  "reach": 20410,
                  "clicks": 622,
                  "ctr": 2.488597,
                  "cpm": 7.655037,
                  "cpp": 9.374326,
                  "frequency": 1.224596,
                  "uniqueClicks": 432,
                  "uniqueCtr": 2.11661,
                  "costPerUniqueClick": 0.442894,
                  "inlineLinkClicks": 538,
                  "costPerInlineLinkClick": 0.355632,
                  "outboundClicks": 468,
                  "costPerOutboundClick": 0.408825,
                  "websiteCtr": [
                      {
                          "action_type": "link_click",
                          "value": "2.152517"
                      }
                  ],
                  "accountCurrency": "USD",
                  "accountName": "John Smith",
                  "accountId": "274948321"
              },
              "minDailyBudget": 1,
              "name": "John Smith",
              "ownerBusiness": {
                  "name": "My Business"
              },
              "spendCap": 0,
              "status": "active",
              "taxIdStatus": "NOT_REQUIRED",
              "timezoneId": 74,
              "timezoneName": "America/New_York",
              "timezoneOffsetHoursUtc": -5
          }
      ],
      "count": 1,
      "lastUpdated": "2025-03-27T00:55:00.000Z",
      "nextUpdate": "2025-03-27T01:05:00.000Z"
  }
  ```

  ```json 400: Fehler bei Werbekonten theme={"system"}
  {
    "action": "get ad accounts",
    "status": "error",
    "code": 366,
    "message": "Error getting ad accounts. Please verify you have an active ad account at Meta. You also might not have granted permission to access your ad account. Please try unlinking and relinking the platform and try again. Contact us if the issue persists."
  }
  ```
</ResponseExample>
