# Get Ad groups

> Source: https://truto.one/docs/api-reference/unified-ads-management-api/adgroups/get/

`GET /unified/ads/ad_groups/{id}`

Resource: **AdGroups** · API: **Unified Ads Management API**

## Supported integrations

LinkedIn, Meta Marketing API

## Path parameters

- **`id`** _(string, required)_
  The ID of the resource.

## Query parameters

- **`integrated_account_id`** _(string, required)_
  The ID of the integrated account to use for the request.
- **`truto_response_format`** _(string)_
  The format of the response. - `unified` returns the response with unified mappings applied. - `raw` returns the unprocessed, raw response from the remote API. - `normalized` applies the unified mappings and returns the data in a normalized format. - `stream` returns the response as a stream, which is ideal for transmitting large datasets, files, or binary data. Using streaming mode helps to efficiently handle large payloads or real-time data flows without requiring the entire data to be buffered in memory. Defaults to `unified`.
  Allowed: `unified`, `raw`, `normalized`, `stream`
- **`truto_ignore_remote_data`** _(boolean)_
  Excludes the `remote_data` attribute from the response.
- **`truto_exclude_fields`** _(array<string>)_
  Array of fields to exclude from the response.
- **`remote_query`** _(object)_
  Query parameters to pass to the underlying API without any transformations. Refer [this guide](https://truto.one/docs/api-reference/overview/querying#remote-query-parameters) to see how to structure the query parameters.
- **`account_id`** _(string)_
  The unique identifier for the account.

## Response body

- **`id`** _(string, required)_
  The unique identifier for the ad_group.
- **`name`** _(string)_
  The name of the ad_group.
- **`status`** _(string)_
  The status of the campaign.
  Allowed: `active`, `inactive`, `draft`, `paused`, `deleted`, `archived`, `in_process`, `with_issues`, `completed`, `canceled`, `pending_deletion`
- **`account_id`** _(string)_
  The unique identifier for the account.
- **`campaign_id`** _(string)_
  The unique identifier for the campaign.
- **`labels`** _(array<object>)_
  The labels for the ad_group.
  - **`id`** _(string)_
    The unique identifier for the label.
  - **`name`** _(string)_
    The name of the label.
- **`attribution_spec`** _(string)_
  The attribution spec for the ad_group.
- **`bid`** _(object)_
  The bid for the ad_group.
  - **`adjustments`** _(object)_
    The bid adjustments for the ad_group.
  - **`amount`** _(string)_
    The bid amount for the ad_group.
  - **`constraints`** _(object)_
    The bid constraints for the ad_group.
  - **`objective_values`** _(object)_
    The bid values for different objectives of the ad_group.
  - **`strategy`** _(object)_
    The bid strategy for the ad_group.
    - **`id`** _(string)_
      The unique identifier for the bid strategy.
    - **`name`** _(string)_
      The name of the bid strategy.
- **`billing_event`** _(string)_
  The billing event for the ad_group.
  Allowed: `app_installs`, `clicks`, `impressions`, `link_clicks`, `none`, `offer_claims`, `page_likes`, `post_engagement`, `video_views`
- **`budget`** _(object)_
  The budget for the ad_group.
  - **`lifetime_max`** _(string)_
    The max budget for the ad_group.
  - **`daily_max`** _(string)_
    The daily max budget for the ad_group.
  - **`daily_min`** _(string)_
    The daily min budget for the ad_group.
- **`spend`** _(object)_
  The spend for the ad_group.
  - **`lifetime_max`** _(string)_
    The max spend for the ad_group.
  - **`daily_min_cap`** _(string)_
    The min cap spend for the ad_group.
  - **`daily_max_cap`** _(string)_
    The max cap spend for the ad_group.
  - **`cap_enabled`** _(boolean)_
    Whether the cap is enabled for the ad_group.
- **`impressions`** _(object)_
  The impressions for the ad_group.
  - **`daily_min`** _(string)_
    The daily min impressions for the ad_group.
  - **`lifetime_max`** _(string)_
    The max impressions for the ad_group.
- **`destination`** _(object)_
  The destination type for the ad_group.
  - **`id`** _(string)_
    The unique identifier for the destination type.
  - **`name`** _(string)_
    The name of the destination type.
    Allowed: `undefined`, `app`, `messenger`, `website`, `instagram_direct`, `on_ad`, `on_post`, `on_video`, `on_page`, `on_event`
- **`start_time`** _(string)_
  The start time for the ad_group.
- **`stop_time`** _(string)_
  The stop time for the ad_group.
- **`issues`** _(array<object>)_
  The issues for the ad_group that prevented ads from being delivered.
  - **`code`** _(string)_
    The code for the issue.
  - **`message`** _(string)_
    The error message for the issue.
  - **`description`** _(string)_
    The error summary for the issue.
  - **`level`** _(string)_
    The level for the issue.
  - **`type`** _(string)_
    The type for the issue.
- **`optimization_goal`** _(string)_
  The optimization goal for the ad_group.
  Allowed: `none`, `app_installs`, `ad_recall_lift`, `clicks`, `engaged_users`, `event_responses`, `impressions`, `lead_generation`, `quality_lead`, `link_clicks`, `offsite_conversions`, `page_likes` (+10 more)
- **`promoted_object`** _(object)_
  The promoted object for the ad_group.
- **`targeting`** _(object)_
  The targeting for the ad_group.
- **`targeting_optimization_types`** _(array<object>)_
  - **`key`** _(string)_
    The key for the targeting optimization type.
  - **`value`** _(string)_
    The value for the targeting optimization type.
- **`schedule`** _(object)_
  The schedule for the ad_group.
  - **`start_time`** _(string)_
    The start time for the ad_group.
  - **`end_time`** _(string)_
    The end time for the ad_group.
  - **`days`** _(array<string>)_
    The days for the ad_group.
- **`created_at`** _(string)_
  The date and time the ad_group was created.
- **`updated_at`** _(string)_
  The date and time the ad_group was last updated.
- **`remote_data`** _(object)_
  Raw data returned from the remote API call.

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/unified/ads/ad_groups/{id}?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const integratedAccountId = '<integrated_account_id>';

const response = await fetch(`https://api.truto.one/unified/ads/ad_groups/{id}?integrated_account_id=${integratedAccountId}`, {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/unified/ads/ad_groups/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.unifiedApi.get(
  'ads',
  'adgroups',
  '<resource_id>',
  { integrated_account_id: '<integrated_account_id>' }
);

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    result = await truto_api.unified_api.get(
        "ads",
        "adgroups",
        "<resource_id>",
        {"integrated_account_id": "<integrated_account_id>"}
    )
    print(result)

asyncio.run(main())
```
