# API - Mobile Engagement Platform

## What are the Batch APIs?

With **Batch RESTful APIs** you can easily send custom data and push notifications to take advantage of Batch’s advanced features from your own systems. There are 7 APIs you can use to cover your needs: engaging with your users, sending custom user data and being GDPR-compliant.

**Engage your users**

All Batch engagement channels: Mobile push, Web push and In-App messages can be completely used remotely via our APIs.

* The [Transactional API](https://doc.batch.com/developer/api/mep/transactional/send) is made for 1-to-1 or 1-to-few interactions. It allows you to send push notifications to a specific list of user IDs (push token, Advertising IDs or Custom User IDs) based on events in your back-end *(e.g. "You have a new friend request")*.
* The [Push Campaigns API](https://doc.batch.com/developer/api/mep/campaigns/create) is made for 1-to-many interactions. It allows you to send push notifications in mass to your users according to [targeting criteria](https://doc.batch.com/getting-started/features/customer-engagement-platform/22-cep-orchestration/02-targeting) (using your custom data or Batch generated data) or with your own segmentation engine with [Custom Audiences](https://doc.batch.com/getting-started/features/customer-engagement-platform/profiles/audiences).
* The [In-App campaigns API](https://doc.batch.com/developer/api/mep/in-app-campaigns-api/create) allows you to send customized [In-App messages](https://doc.batch.com/getting-started/features/mobile-engagement-platform/in-app-messaging/overview) to your users, the targeting method being quite close to the Campaigns API.

**Send custom data**

You probably want to send Batch some custom data for campaign targeting and message personnalisation purposes. Our APIs enables you to send us data at three different scale: the app, a group of users and a single user.

* The [App Data API](https://doc.batch.com/developer/api/mep/app-data/create) allows you to send custom data you **associated to your application**. This is particularly useful if you need app-level in your campaigns, such as dates or attributes *(e.g. Quick! Premium subscription discount will end in **3 days**)*
* The [Custom Audience API](https://doc.batch.com/developer/api/mep/custom-audience/1.0/create) allows you to send Batch **specific lists of user IDs** for your push and In-App campaign targeting. Your own segmentation will then be available on the dashboad as a [Custom Audience](https://github.com/BatchLabs/product.tech-documentation-gitbook/blob/master/dashboard/push/user-targeting/README.md#custom-audiences).
* The [Custom Data API](https://doc.batch.com/developer/api/mep/custom-data-api/set-update) to send custom data on **specific custom user IDs** to improve your campaign targetings and personnalization with your own custom data.

**Protecting your users' data**

Being GDPR-compliant, Batch let you make requests to fetch and/or delete user data from our database. Our [GDPR API](https://doc.batch.com/developer/api/mep/gdpr/create) allows you to make those requests and regain control of Batch's collected user data.

**Get data export**

Batch let you make requests to get data from our database. Our [Export API](https://doc.batch.com/developer/api/mep/export/create) allows you to make those requests and get back data concerning to your audience.

> Take a look at [this guide](https://github.com/BatchLabs/product.tech-documentation-gitbook/blob/master/guides/batch-APIs/README.md) if you want to know more on how to use our APIs.

## How do I get started?

**Prerequisites**

Before sending your first notification with Batch REST API, make sure you have:

* Your Batch **REST API key**.
* Your **app API key** or your website **SDK API key**.

You will find these IDs in your app settings, on Batch dashboard (⚙️ Settings → General). Please note you need to be the manager of the account to see the REST API key.

**Request headers**

You will need to use the same api keys and headers for both the campaigns or the transactional API. Here is an example of a valid request syntax:

```bash
curl -H "Content-Type: application/json" -H "X-Authorization: BATCH_REST_API_KEY" -X POST -d
"@payload.json" "https://api.batch.com/1.1/BATCH_API_KEY/campaigns/create"
```

```bash
curl -H "Content-Type: application/json" -H "X-Authorization: BATCH_REST_API_KEY" -X GET
"https://api.batch.com/1.1/BATCH_API_KEY/campaigns/stats/CAMPAIGN_TOKEN"
```

* `BATCH_REST_API_KEY` is your **REST API key**. It goes in the `X-Authorization` header.
* `BATCH_API_KEY` is you **app API key** or the **SDK API key** of your website. It is the one that goes in the URL.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.batch.com/developer/api/mep.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
