Introduction
Welcome to the ExpressMaps API. You can use our API to manage your ExpressMaps API keys including the following operations:
- Listing your keys
- Creating a new key
- Modifying an existing key
- Adding or removing domain referrer restrictions
- Enabling or Disabling a key
- Deleting a key
We have language bindings in cURL / Shell, JavaScript and PHP. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Authentication
We use Bearer authentication for requests to the ExpressMaps API endpoints.
Before you can use this API, you'll need to retrieve one of your API Management keys. These can be found on your ExpressMaps Console / Settings page. You should have two keys:
Read-Only Key - used for read only operations (for example, listing your keys or reading a specific key)
Read-Write Key - required when adding, editing or deleting a key
We suggest you use the Read-Write key to get started.
Authenticate your requests by passing one of these keys in the Authorization header as "Bearer {your-api-key}".
Authorization: Bearer your-api-key
Keys
List all keys
curl -X GET https://api.expressmaps.com/keys \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {your-api-key}'
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {your-api-key}'
};
fetch('https://api.expressmaps.com/keys',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {your-api-key}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://api.expressmaps.com/keys', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
?>
The above command returns JSON structured like the following:
{
"keys": [
{
"name": "Friendly key name",
"uuid": "em7fa91fbc9d344ec1994e4ccf2d3d00",
"created": 1601018765,
"modified": 1601020595,
"status": "Enabled",
"referrer_restrictions": [
"example.com",
"other-website.com"
],
"ip_restrictions": null
}
GET /keys
This endpoint retrieves all keys in your account and returns them in a JSON array of keys.
Create a key
curl -X POST https://api.expressmaps.com/keys \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {your-api-key}'
const inputBody = '{
"name": "Key name",
"status": "Disabled",
"referrer_restrictions": [
"new-url.com"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {your-api-key}'
};
fetch('https://api.expressmaps.com/keys',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {your-api-key}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://api.expressmaps.com/keys', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
?>
Body Parameters
{
"name": "Key name",
"status": "Disabled",
"referrer_restrictions": [
"new-url.com"
]
}
POST /keys
This endpoint creates a new API key. Once the key is created, it is immediately activated and can be used to access ExpressMaps mapping services.
By default, the key is not restricted in any way so we recommend adding domain restrictions to the key using the Update a key method.
Parameter | In | Description |
---|---|---|
name | body | The key name [Required] |
status | body | 'Enabled' or 'Disabled' (defaults to 'Enabled') |
referrer_restrictions | body | A JSON array of domain names (defaults to none) |
The above command returns JSON structured like the following:
{
"key": {
"uuid": "ea6a3c647c5847bbbfa601d723b2612b",
"name": "My Key name",
"created": 1619956381,
"modified": "",
"status": "Enabled"
},
"status_message": "OK"
}
Update a key
curl -X PATCH https://api.expressmaps.com/keys/{keyUUID} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {your-api-key}'
const inputBody = '{
"name": "New key name",
"status": "Disabled",
"referrer_restrictions": [
"new-url.com"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {your-api-key}'
};
fetch('https://api.expressmaps.com/keys/{keyUUID}',
{
method: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {your-api-key}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PATCH','https://api.expressmaps.com/keys/{keyUUID}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
?>
Body Parameters
{
"name": "New key name",
"status": "Disabled",
"referrer_restrictions": [
"new-url1.com",
"new-url2.com"
]
}
PATCH /keys/{keyUUID}
This endpoint updates an existing API key. The key can be renamed, enabled or disabled and the domain restrictions can be updated.
By default, the key is not restricted in any way so we recommend adding domain restrictions to the key using the Update a key method.
Parameter | In | Description |
---|---|---|
keyUUID | path | The uuid of the key that you are updating [Required] |
name | body | The new key name |
status | body | "Enabled" or 'Disabled' |
referrer_restrictions | body | A JSON array of domain names or either an empty array or a null value to clear all existing restrictions |
The above command returns JSON structured like the following:
{
"key": {
"uuid": "ea6a3c647c5847bbbfa601d723b2612b",
"name": "My Key name",
"created": 1619956381,
"modified": "",
"status": "Enabled"
},
"status_message": "OK"
}
Delete a key
curl -X DELETE https://api.expressmaps.com/keys/{keyUUID} \
-H 'Authorization: Bearer {your-api-key}'
const headers = {
'Authorization':'Bearer {your-api-key}'
};
fetch('https://api.expressmaps.com/keys/{keyUUID}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {your-api-key}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://api.expressmaps.com/keys/{keyUUID}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
?>
DELETE /keys/{keyUUID}
This endpoint deletes an existing API key.
Parameter | In | Description |
---|---|---|
keyUUID | path | The uuid of the key that you are deleting [Required] |
The above command returns JSON structured like the following:
{
"status_message": "OK"
}