# Audience Groups API Reference

Source: https://instatus.com/help/api/audience-groups

## Get all your status page audience groups

**Endpoint:**

```bash
GET /v1/:page_id/audience-groups?page=:page&per_page=:per_page
```

- The default page number is 1.
- The default per_page number is 50 and the maximum is 100 items per page.

**Example response:**

```json
[
	{
		"id": "clhaasg3d017058vlp22h9k6w",
		"siteId": "clcqs5tob3338jrvlf76mhd7t",
		"name": "Audience Group 1",
		"teammates": [
			{
				"id": "clhaasg3e017358vlnedqbt7x",
				"audienceGroupId": "clhaasg3d017058vlp22h9k6w",
				"teammateId": "clc38kure253016ivlpsuq3vx1",
				"teammate": {
					"id": "clc38kure253016ivlpsuq3vx1",
					"user": {
						"id": "cl8slhcwu6084mfndq6eh9tq7",
						"name": null,
						"email": "buzz@lightyear.com",
						"avatar": null
					}
				}
			}
		],
		"components": [
			{
				"id": "clhaasg3e017158vlj8lakqhz",
				"audienceGroupId": "clhaasg3d017058vlp22h9k6w",
				"componentId": "clcqs5usl3350jrvllb1l2sge",
				"component": {
					"id": "clcqs5usl3350jrvllb1l2sge",
					"name": "Website",
					"nameTranslationId": null,
					"description": "",
					"descriptionTranslationId": null,
					"status": "OPERATIONAL",
					"order": 1,
					"showUptime": true,
					"createdAt": "2023-01-10T22:04:17.061Z",
					"updatedAt": "2023-01-10T22:04:17.062Z",
					"archivedAt": null,
					"siteId": "clcqs5tob3338jrvlf76mhd7t",
					"uniqueEmail": "testing-amr-as-owner-private-website-lcqh533jn@automation.instatus.com",
					"groupId": null,
					"nameHtml": null,
					"nameHtmlTranslationId": null,
					"descriptionHtml": null,
					"descriptionHtmlTranslationId": null,
					"isThirdParty": false,
					"thirdPartyStatus": null,
					"thirdPartyComponentId": null,
					"thirdPartyComponentServiceId": null,
					"importedFrom": null,
					"startDate": null,
					"nameTranslation": null,
					"descriptionTranslation": null,
					"group": null
				}
			}
		]
	},
	{
		"id": "clhaaulxw021758vl1hejod67",
		"siteId": "clcqs5tob3338jrvlf76mhd7t",
		"name": "Audience Group 2",
		"teammates": [
			{
				"id": "clhaaulxw021958vlzllc63j4",
				"audienceGroupId": "clhaaulxw021758vl1hejod67",
				"teammateId": "clc38kure253016ivlpsuq3vx1",
				"teammate": {
					"id": "clc38kure253016ivlpsuq3vx1",
					"user": {
						"id": "cl8slhcwu6084mfndq6eh9tq7",
						"name": null,
						"email": "buzz@lightyear.com",
						"avatar": null
					}
				}
			}
		],
		"components": [
			{
				"id": "clhaaulxw021858vlmtm1rkh4",
				"audienceGroupId": "clhaaulxw021758vl1hejod67",
				"componentId": "clcqs5vq73360jrvlopq778mo",
				"component": {
					"id": "clcqs5vq73360jrvlopq778mo",
					"name": "App",
					"nameTranslationId": null,
					"description": "",
					"descriptionTranslationId": null,
					"status": "OPERATIONAL",
					"order": 2,
					"showUptime": true,
					"createdAt": "2023-01-10T22:04:18.271Z",
					"updatedAt": "2023-01-10T22:04:18.272Z",
					"archivedAt": null,
					"siteId": "clcqs5tob3338jrvlf76mhd7t",
					"uniqueEmail": "testing-amr-as-owner-private-app-jqzpp2xqn@automation.instatus.com",
					"groupId": null,
					"nameHtml": null,
					"nameHtmlTranslationId": null,
					"descriptionHtml": null,
					"descriptionHtmlTranslationId": null,
					"isThirdParty": false,
					"thirdPartyStatus": null,
					"thirdPartyComponentId": null,
					"thirdPartyComponentServiceId": null,
					"importedFrom": null,
					"startDate": null,
					"nameTranslation": null,
					"descriptionTranslation": null,
					"group": null
				}
			}
		]
	}
]
```

## Get an audience group

**Endpoint:**

```bash
GET /v1/:page_id/audience-groups/:audience_group_id
```

**Example response**

```json
{
	"id": "clhaasg3d017058vlp22h9k6w",
	"siteId": "clcqs5tob3338jrvlf76mhd7t",
	"name": "Audience Group 1",
	"teammates": [
		{
			"id": "clhaasg3e017358vlnedqbt7x",
			"audienceGroupId": "clhaasg3d017058vlp22h9k6w",
			"teammateId": "clc38kure253016ivlpsuq3vx1",
			"teammate": {
				"id": "clc38kure253016ivlpsuq3vx1",
				"user": {
					"id": "cl8slhcwu6084mfndq6eh9tq7",
					"name": null,
					"email": "buzz@lightyear.com",
					"avatar": null
				}
			}
		}
	],
	"components": [
		{
			"id": "clhaasg3e017158vlj8lakqhz",
			"audienceGroupId": "clhaasg3d017058vlp22h9k6w",
			"componentId": "clcqs5usl3350jrvllb1l2sge",
			"component": {
				"id": "clcqs5usl3350jrvllb1l2sge",
				"name": "Website",
				"nameTranslationId": null,
				"description": "",
				"descriptionTranslationId": null,
				"status": "OPERATIONAL",
				"order": 1,
				"showUptime": true,
				"createdAt": "2023-01-10T22:04:17.061Z",
				"updatedAt": "2023-01-10T22:04:17.062Z",
				"archivedAt": null,
				"siteId": "clcqs5tob3338jrvlf76mhd7t",
				"uniqueEmail": "testing-amr-as-owner-private-website-lcqh533jn@automation.instatus.com",
				"groupId": null,
				"nameHtml": null,
				"nameHtmlTranslationId": null,
				"descriptionHtml": null,
				"descriptionHtmlTranslationId": null,
				"isThirdParty": false,
				"thirdPartyStatus": null,
				"thirdPartyComponentId": null,
				"thirdPartyComponentServiceId": null,
				"importedFrom": null,
				"startDate": null,
				"nameTranslation": null,
				"descriptionTranslation": null,
				"group": null
			}
		}
	]
}
```

## Create an audience group

**Endpoint:**

```bash
POST /v1/:page_id/audience_groups
```

**Example request:**

```json
{
	"name": "Audience Group 1",
	"components": ["clcqs5usl3350jrvllb1l2sge"],
	"teammates": ["clc38kure253016ivlpsuq3vx1"]
}
```

**Example response:**

```json
{
	"id": "clhaasg3d017058vlp22h9k6w",
	"siteId": "clcqs5tob3338jrvlf76mhd7t",
	"name": "Audience Group 1",
	"site": {
		"id": "clcqs5tob3338jrvlf76mhd7t"
	}
}
```

## Update an audience group

**Endpoint:**

```bash
PUT /v1/:page_id/audience_groups/:audience_group_id
```

**Example request:**

```json
{
	"components": ["clcqs5usl3350jrvllb1l2sge", "clcqs5vq73360jrvlopq778mo"]
}
```

**Example response:**

```json
{
	"id": "clhaasg3d017058vlp22h9k6w",
	"siteId": "clcqs5tob3338jrvlf76mhd7t",
	"name": "Audience Group 1",
	"site": {
		"id": "clcqs5tob3338jrvlf76mhd7t"
	}
}
```

## Delete an audience group

**Endpoint:**

```bash
DELETE /v1/:page_id/audience-groups/:audience_group_id
```

```json
{
	"id": "clhaaulxw021758vl1hejod67",
	"siteId": "clcqs5tob3338jrvlf76mhd7t",
	"name": "Audience Group 2",
	"site": {
		"id": "clcqs5tob3338jrvlf76mhd7t"
	}
}
```
