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

# Get Campaign

> Read a Google Ads campaign's status and daily budget, and Google's review of each of its ads or assets.

Get a Google Ads campaign you created through Ayrshare: its name, status, daily budget, and Google's review of each of its ads.

## Header Parameters

**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`

## Path Parameters

**id** `string` *required*

The `campaignId` returned when you created the campaign.

## Response

| Field | What it holds |
| - | - |
| `campaignId` | The campaign's id |
| `name` | The campaign name |
| `campaignStatus` | `active` or `paused` |
| `platformStatus` | Google's own status: `ENABLED`, `PAUSED`, or `REMOVED` for a campaign deleted in Google Ads. A removed campaign keeps the last `campaignStatus` you set through Ayrshare |
| `budget` | The daily budget: `amount`, `currency` (the ad account's currency) and `type` (`daily`) |
| `ads` | Google's review of each ad (Search) or asset (Performance Max). See [Ad Review](#ad-review) |

## Ad Review

Google reviews every new ad against its advertising policies, usually within one business day. Each row in `ads` holds:

| Field | What it holds |
| - | - |
| `adId` | The ad's id, as returned by Create |
| `approvalStatus` | Google's decision: `APPROVED`, `APPROVED_LIMITED` (shown with limits, for example not in some countries), `AREA_OF_INTEREST_ONLY` or `DISAPPROVED`. Until Google decides, it holds another value, such as `UNKNOWN` or `UNSPECIFIED` |
| `reviewStatus` | Where the review stands, for example `REVIEW_IN_PROGRESS` or `REVIEWED` |
| `policyTopics` | The policies behind a limit or disapproval: `[{ "topic": "ALCOHOL", "type": "PROHIBITED" }]` |

A disapproved ad does not serve. Change it in Google Ads, or create a new campaign with compliant text. `ads` is left out when Google's review could not be read at that moment, or took more than a few seconds; read the campaign again later.

Each night, Ayrshare also checks every review and sends an `ads` webhook with `type: "reviewChanged"` when Google's decision changes. See [Ads Action](https://www.ayrshare.com/docs/apis/webhooks/actions.md#ads-action).

## Asset Review

Google reviews each asset of a Performance Max campaign on its own. `ads` holds one row per asset, with the same fields as an [ad review](#ad-review) plus:

| Field | What it holds |
| - | - |
| `adId` | The asset's key in this campaign: `asset:<assetGroupId>~<assetId>~<fieldType>`, or `asset:<campaignId>~<assetId>~<fieldType>` for a brand asset |
| `assetId` | Google's id for the asset |
| `fieldType` | Where it is used, for example `HEADLINE`, `MARKETING_IMAGE`, `SQUARE_MARKETING_IMAGE`, `BUSINESS_NAME` or `LOGO` |
| `primaryStatus` | Whether it can serve, for example `ELIGIBLE` or `NOT_ELIGIBLE` |

The business name, logos and landscape logos are brand assets, linked to the campaign rather than the asset group. They have a row here too, after the asset group rows, keyed by the campaign id: `asset:<campaignId>~<assetId>~<fieldType>`, where `fieldType` is `BUSINESS_NAME`, `LOGO` or `LANDSCAPE_LOGO`.

## Errors

| Code | When |
| - | - |
| `400` | The campaign is not yours, does not exist, or is no longer in the Google Ads account. Also when the Google user you linked cannot access the ad account, or Google Ads access was revoked. |
| `370` | Google could not complete the request. Try again. |

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

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

fetch("https://api.ayrshare.com/api/ads/google/campaigns/21534567890", {
  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/campaigns/21534567890", 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/campaigns/21534567890",
    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/campaigns/21534567890");
        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/campaigns/21534567890", 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 GetCampaign {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.ayrshare.com/api/ads/google/campaigns/21534567890"))
            .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/campaigns/21534567890')

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: Search Campaign theme={"system"}
{
  "status": "success",
  "platform": "google",
  "campaignId": "21534567890",
  "name": "Fall sale",
  "campaignStatus": "active",
  "platformStatus": "ENABLED",
  "budget": { "amount": 25, "currency": "USD", "type": "daily" },
  "ads": [
    {
      "adId": "71234567890",
      "approvalStatus": "APPROVED_LIMITED",
      "reviewStatus": "REVIEWED",
      "policyTopics": [{ "topic": "ALCOHOL", "type": "LIMITED" }]
    }
  ]
}
```

```json 200: Performance Max Campaign theme={"system"}
{
  "status": "success",
  "platform": "google",
  "campaignId": "21534567891",
  "name": "Fall sale PMax",
  "campaignStatus": "paused",
  "platformStatus": "PAUSED",
  "budget": { "amount": 40, "currency": "USD", "type": "daily" },
  "ads": [
    {
      "adId": "asset:6512345678~31234567890~HEADLINE",
      "assetId": "31234567890",
      "fieldType": "HEADLINE",
      "primaryStatus": "ELIGIBLE",
      "approvalStatus": "APPROVED",
      "reviewStatus": "REVIEWED",
      "policyTopics": []
    }
  ]
}
```

```json 400: Not Found theme={"system"}
{
  "action": "ads",
  "status": "error",
  "code": 400,
  "message": "Campaign not found or you are not authorized to access it."
}
```


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