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

# Accounts

> वे Google Ads खाते सूचीबद्ध करें जिनमें आप अभियान बना सकते हैं, और देखें कि Google कौन-से लिंक किए गए खाते नहीं खोलने देता और क्यों।

वे Google Ads खाते पाएँ जिनमें आप अभियान बना सकते हैं। अभियान बनाते समय खाते के `id` को `accountId` के रूप में उपयोग करें।

<ul>
  <li>पहले "Social Accounts" पेज से Google Ads लिंक करें।</li>
  <li>आप जिस Google यूज़र को लिंक करते हैं, उसके पास विज्ञापन खाते का सीधा एक्सेस होना चाहिए। जिन खातों तक आप केवल किसी मैनेजर खाते के माध्यम से पहुँचते हैं, वे सूचीबद्ध नहीं होते और अभी उनका उपयोग नहीं किया जा सकता: उस यूज़र को सीधे विज्ञापन खाते में जोड़ें। मैनेजर खाते भी सूचीबद्ध नहीं होते: उनमें अभियान नहीं हो सकते।</li>
  <li>सभी खाते एक ही रिस्पॉन्स में लौटते हैं, इसलिए `nextCursor` हमेशा `null` होता है।</li>
</ul>

## हेडर पैरामीटर

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## रिस्पॉन्स

`adAccounts` उन खातों को सूचीबद्ध करता है जिनका आप उपयोग कर सकते हैं, हर खाते के `id`, `name` और `currency` के साथ।

यदि Google किसी खाते को सूचीबद्ध करता है लेकिन उसे खोलने नहीं देता, तो रिस्पॉन्स में `unavailableAccounts` भी होता है। हर प्रविष्टि में खाते का `id` और एक `reason` होता है। जब हर खाते का उपयोग किया जा सकता है, तब यह फ़ील्ड मौजूद नहीं होता।

| `reason` | इसका अर्थ | क्या करें |
| - | - | - |
| `notEnabled` | खाता रद्द है, निलंबित है, या अभी सेट अप नहीं हुआ है। | Google Ads में सेटअप पूरा करें या खाते को फिर से सक्रिय करें, फिर खातों को दोबारा सूचीबद्ध करें। बदलाव दिखने में लगभग 10 मिनट तक लग सकते हैं। |
| `noAccess` | आपके द्वारा लिंक किया गया Google यूज़र खाता देख सकता है, लेकिन उसके डेटा तक उसकी पहुँच नहीं है। | Google Ads में उस यूज़र को विज्ञापन खाते का एक्सेस दें, फिर खातों को दोबारा सूचीबद्ध करें। बदलाव दिखने में लगभग 10 मिनट तक लग सकते हैं। |

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

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

fetch("https://api.ayrshare.com/api/ads/google/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/google/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/google/accounts",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer API_KEY"
    ]
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error: " . $err;
} else {
    echo $response;
}
?>
```

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

class Program
{
    static async Task Main(string[] args)
    {
        var client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", "Bearer API_KEY");

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

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

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

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

func main() {
    req, _ := http.NewRequest("GET", "https://api.ayrshare.com/api/ads/google/accounts", nil)
    req.Header.Add("Authorization", "Bearer API_KEY")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    defer resp.Body.Close()

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

```java Java theme={"system"}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class GetAdAccounts {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.ayrshare.com/api/ads/google/accounts"))
            .header("Authorization", "Bearer API_KEY")
            .GET()
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

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

uri = URI.parse('https://api.ayrshare.com/api/ads/google/accounts')

request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer API_KEY'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "adAccounts": [{ "id": "1234567890", "name": "Acme", "currency": "USD" }],
  "nextCursor": null,
  "unavailableAccounts": [{ "id": "2345678901", "reason": "notEnabled" }]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.