• iOS
  • Android
  • Windows
  • Web
  • Cordova
  • Unity
  • Adobe Air
  • Dashboard
  • API
  • Guides
  • Third Party Integrations
  • FAQ
  • API > In-App Campaigns API

    GET - View In-App campaign

    The get endpoint allows you to get details about an In-App campaign using its unique token.

    Request structure


    The In-App campaigns API exposes a GET endpoint at: https://api.batch.com/1.1/BATCH_API_KEY/in-app-campaigns/CAMPAIGN_TOKEN

    Here are examples of valid cURL, PHP or Python requests syntax:

    curl -X GET "https://api.batch.com/1.1/BATCH_API_KEY/in-app-campaigns/CAMPAIGN_TOKEN" \
    -H "Content-Type: application/json" \
    -H "X-Authorization: BATCH_REST_API_KEY"
    use GuzzleHttp\Client;
    $client = new Client();
    $response = $client->request("GET", "https://api.batch.com/1.1/BATCH_API_KEY/in-app-campaigns/CAMPAIGN_TOKEN", [
        "headers" => [
            "Content-Type" => "application/json",
            "X-Authorization" => "BATCH_REST_API_KEY"
    import requests, json
    response = requests.request("GET", "https://api.batch.com/1.1/BATCH_API_KEY/in-app-campaigns/CAMPAIGN_TOKEN", 
            'Content-Type': 'application/json'
            'X-Authorization': 'BATCH_REST_API_KEY'

    Note: Only LIVE API Keys are supported by this API


    In order to authenticate with the API, you need to provide your company REST API Key as the value of the X-Authorization header.



    If the GET to the API endpoint is successfull you will receive an HTTP 200 confirmation and details about your In-App campaign.

    The output format is the same than the one used to create a campaign, except that the four following fields are added :

    Id Description
    campaign_token String -
    The token number of the campaign.
    from_api Boolean -
    Value that indicates whether or not the campaign were created with the API. `false` value means the campaign were created with the dashboard.
    dev_only Boolean -
    Value that indicates whether or not the campaign only targets developers.
    created_date String -
    Creation date of the campaign.

    Here is an example of output :

        "campaign_token": "70448bafec76439d534ec98ea7ab712c",
        "from_api": true,
        "dev_only": false,
        "created_date": "2018-08-13T10:11:38",
        "name": "In-App campaign name",
        "live": true,
        "end_date": "2018-10-31T17:30:00",
        "trigger": {
            "capping": 10,
            "when": "next_session",
            "grace_period": {
                "every": 2,
                "unit": "HOURS"
        "targeting": {
            "segments": [
        "landing": {
            "theme": "THEME_CODE",
            "contents": [
                    "language": "fr",
                    "title": "Landing title",
                    "body": "Landing body",
                    "actions": [
                            "action": "DISMISS",
                            "label": "Ok"


    If the GET data does not meet the API requirements you will receive an actionable error message. Contact us at support@batch.com if you need further support.

    • AUTHENTICATION_INVALID (Http status code: 401, Error code: 10)
    • ROUTE_NOT_FOUND (Http status code: 404, Error code: 20)
    • SERVER_ERROR (Http status code: 500, Error code: 0)
    • TOO_MANY_REQUESTS (Http status code: 429, Error code: 60)
      If you get a "too many requests" response, please wait for at least 5 seconds before trying again. Further requests might still return this error.