# Admin API
expert team enterprise
Keitaro Admin API is an interface that allows you to manage the Keitaro tracker admin panel through incoming requests. That is, without entering the admin panel of the tracker, you can, for example, create a campaign with the necessary settings, change the content of the flow or generate a report on conversions, using server script or an external app like Postman.
# Admin API methods
# How to use Admin API
Keitaro performs all requests from control panel through Admin API, so you can explore behavior for different requests by using Chrome Developers tools to investigate the set of parameters which you can use in different requests.
- Open Chrome, then View → Developer → Developer tools.
- Switch to Network, opt in Fetch / XHR.
- Click on a request, then switch to Payload.
To get better performance, Keitaro combines multiple requests in one. Keitaro makes these requests through
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://example.com/admin_api/v1/campaigns'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: <your-api-key>')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo curl_exec($ch);
your-api-key must be replaced to valid API Key.
It is possible to send API key as a bearer token:
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer <your-api-key>'));`
# Creating Admin API request
To create a valid request you must
Use an authorization key (a key that prevents third-party users from getting information).
Use the correct type of request.
Set mandatory parameters (required for entity creation requests, for example, campaign creation).
You can get the authentication key in the tracker, under Maintenance — Users — Admin API keys.
The following query type set is used when working with the Keitaro Admin API:
GET - to retrieve information, such as a list of tracker campaigns:
POST - to build reports, as well as to create something, such as a new campaign in the tracker:
Note that the request address looks the same: in both cases we are addressing to a "tracker entry point", which contains:
- The address of the tracker is keitarosupport1.xyz
- Further points to Admin API section — admin_api/v1/
- Specific subsection of the tracker, campaigns — campaigns.
PUT - to update existing data in the tracker
DELETE - to delete data in the tracker.
We also need a list of required query parameters.
Look at documentation
Find the type of request you want to make, and there will also be a list of required parameters. The list of required parameters to create a campaign in the tracker includes:
By setting only these two parameters, you can create a campaign. The rest of the campaign's settings will be set by default.
# Swagger documentation
It is an interface that combines our Admin API documentation and the ability to send real requests to the tracker. To get started here, open Maintenance — Users — Admin API keys, copy your key and click on the Documentation tab. You will be taken to the interactive mode, where you can work with requests.
The first thing you need to do is to log in:
Select the section, such as creating a campaign:
Try it out. This will give us the opportunity to edit our request body, which will be sent when the
Execute button is pressed. Inside this
body we set our
alias, and any additional ones that we want to specify on creating the campaign.
Press Execute and see already sent request, the request address and the answer from the tracker:
If the request occurred with an error, you will see a different response status, and in the
Response body field is a description of the error.
If you have basic querying skills — you can try to work with Admin API from third-party app, for example, Postman. Or you can try to write your own server script that will send request to Admin API.
# Other languages support
Swagger-codegen will be able to generate code in any language you can build in your service.
Generating golang files to output/ directory.
Found an error?
Please help us make this documentation better. If you find any inaccuracies or errors, please email us at
# Third-party libraries
Why does an empty POST request get a '400 Bad Request' error?
Add to the code:
curl_setopt($ch, CURLOPT_POSTFIELDS, '');