• iOS
  • Android
  • Windows
  • Cordova
  • Web
  • Unity
  • Adobe Air
  • Dashboard
  • API
  • Guides
  • FAQ
  • Documentation > API

    Overview

    Push API

    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 basically three APIs you can use in your app to cover all your marketing needs:

    • The Custom Data API to send custom data on specific custom user IDs (iOS/Android) and improve your campaign targetings.
    • The Transactional API allows you to send notifications to a specific token or custom user ID based on events in your back-end (e.g. "You have a new friend request").
    • The Campaigns API allows you to send push notifications in mass to your segments (attributes, events) or to segments generated by Batch (country/language, dormant users, app version, etc).

    Take a look at this guide 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.
    • At least a Pro plan for the Campaigns API.
    • At least a Premier plan for the Custom Data API.

    You will find them in your app settings, on Batch dashboard (⚙️ Settings → General).

    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:

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