PG电子竞技imp Developer LogoPG电子竞技imp Developer Wordmark

Marketing API Quick Start

At a glance

This guide will give you everything you need to start using the PG电子竞技imp Marketing API to manage audiences, control automation workflows, sync email activity with your database, and more. We’ll walk through generating your API key, installing the client library for your preferred language, and making your first API call—a simple request to the Ping endpoint.

Create an account

If you don't have a PG电子竞技imp account already, you’ll need to create one in order to use the API.

Generate your API key

The simplest way to authenticate a request to the Marketing API is using an API key

Here’s how you can generate one for yourself: 

  1. Navigate to the API Keys section of your PG电子竞技imp account.

  2. Click Create New Key and give it a descriptive name that will remind you which application it’s used for. Copy the generated key immediately and store it in a secure location. You won’t be able to see or copy the key once you finish generating it.

Note: It’s important to remember that your PG电子竞技imp API key provides full account access, so you should keep it secure, as you would with a password. Because of the potential security risks associated with exposing account API keys, PG电子竞技imp does not support client-side calls to the Marketing API using CORS requests, nor should API keys be used in mobile apps.

If you’re creating integrations that require access to PG电子竞技imp on behalf of other PG电子竞技imp users, you’ll want to set up authentication via Oauth 2 instead. 

Install the client library for your language

You can make calls to the Marketing API with whichever method you usually use to make HTTP requests, but PG电子竞技imp offers client libraries that make interacting with the API even simpler. 

To install the client library for your preferred language:

Install your client library

# No client installation necessary; just using curl

Make your first API call

To test that you have everything set up correctly, we’ll make a simple request to the Ping endpoint. Hitting this endpoint acts as a health check on the PG电子竞技imp API service; it won’t affect your account in any way. 

To find the value for the server parameter used in mailchimp.setConfig, log into your PG电子竞技imp account and look at the URL in your browser. You’ll see something like; the us19 part is the server prefix. Note that your specific value may be different.

Make your first API call

# install jq:


curl -sS \
  "http://${dc}" \
  --user "anystring:${apikey}" | jq -r

If everything was set up correctly and the request to ping was a success, the response should look like the following:

Ping endpoint response

   "health_status": "Everything's Chimpy!"

Next steps

Now that you’re successfully making authenticated requests to the API with your API key and client library of choice, you’re ready to dive into the PG电子竞技imp Marketing API. 

The first thing you may want to do is learn how to create your first audience and add new contacts to that audience using the API. You may also want to familiarize yourself with the Marketing API docs, which outline some of the common conventions you’ll run into across the API, or browse the extensive API Reference documentation.