IPv4 to IPv6 Proxy API
This API allows you to manage the configuration of IPv4 to IPv6 proxy servers. These proxies allow you to host a website on an IPv6-only server, and make it accessible to both IPv4 and IPv6 users.
Authentication and authorisation
This API uses our auth service. Credentials for using this API can be obtained from the API Keys section of the control panel. Credentials can be unrestricted, allowing them to manage all proxies for all domains domains on your account, or restricted to individual domains or hostnames.
Authentication for the Proxy API is done using a "Bearer token". Under this method you provide your credentials to the auth service which will return a token which can be used in subsequent requests. See the documentation for the auth service for more details.
API overview
The API allows you to manipulate endpoints. An endpoint is identified by the combination of the following properties:
domain
– the domain part of the hostname to be proxied (e.g. "example.com").hostname
– the host part of the hostname to be proxied (e.g. "www").address
– the IPv6 address of the server to which requests are proxied.site
– the site in which the proxy server is located, orall
if this endpoint exists on all proxy servers.
An endpoint has the following flag:
proxy
– iftrue
, requests will be proxied using PROXY protocol rather than plain HTTP/HTTPS requests.
domain
must correspond to a domain on your customer account. This can be either a registered domain, or a "3rd party domain".
hostname
can be the special value @
to indicate that it is the domain name itself that is to be proxied.
address
must be an IPv6 address within the Mythic Beasts network.
site
should normally use the default value of all
indicating that the endpoint is to be configured on all proxy servers.
Fetching endpoints
The API uses hierarchical URLs of the form:
/endpoints
/endpoints/<domain>
/endpoints/<domain>/<hostname>
/endpoints/<domain>/<hostname>/<address>
/endpoints/<domain>/<hostname>/<address>/<site>
All of the above URLs support GET
requests, and will return information
about all endpoints on the account that match the provided parts of the
URL. For example, a GET
to:
/endpoints
will return all endpoints to which the API token has access, whereas a GET
to:
/endpoints/example.com/www
will return endpoints configured for www.example.com.
Updating endpoints
Endpoints can be created or modified using a PUT
request, or deleted
using a DELETE
request to the following URLs:
/endpoints/<domain>/<hostname>
/endpoints/<domain>/<hostname>/<address>
/endpoints/<domain>/<hostname>/<address>/<site>
A PUT
request will replace all endpoints that match the provided parts of
the URL. Similarly, a DELETE
request will delete all endpoints that
match the URL.
In addition, the first URL supports POST
requests, which can be used to
add additional endpoints without replacing existing ones.
Base URL
The base URL for this service is:
- https://api.mythic-beasts.com/proxy
The endpoints listed below should be appended to the above URL.
Getting started
To get started using this API:
-
Create an API key with access to the Proxy API using the customer control panel.
-
Use your API key credentials to obtain an auth token, as shown in this Auth API example.
-
Make a request:
curl -D- -H "Authorization: Bearer $TOKEN" https://api.mythic-beasts.com/proxy/endpoints
The above assumes that you have an auth token in the TOKEN
environment
variable from step (2), and should produce a list endpoints configured on
your accoun that the API key has access to.
Endpoints
get /endpoints
get /endpoints/{domain}
get /endpoints/{domain}/{hostname}
get /endpoints/{domain}/{hostname}/{address}
get /endpoints/{domain}/{hostname}/{address}/{site}
Get endpoint information.
This will return all endpoints that match the specified URL path, and which the access token has permission to read.
If the {hostname}
URL parameter is not specified (first two URL
forms), and there are no matching endpoints, a 200
response with an
empty list will be returned.
If the {hostname}
URL parameter is specified (last three URL forms),
and there are no matching endpoints, the API will return a 404
response.
Responses
Code | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | List of endpoints application/json
Example
|
||||||||||||||
404 | Indicates that there are no endpoints matching the provided URL
parameters. Note that this response code is only used if
the URL includes the |
||||||||||||||
400 | Bad input | ||||||||||||||
401 | Not authenticated | ||||||||||||||
403 | Not authorised |
put /endpoints/{domain}/{hostname}
put /endpoints/{domain}/{hostname}/{address}
put /endpoints/{domain}/{hostname}/{address}/{site}
Update endpoints
This will create or update endpoints. Any endpoints that match the specified URL path will be replaced with the information provided in the body of the request.
Request Body JSON
Name | Description |
---|---|
endpoints array |
(Required) List of endpoints to add. |
address string |
(Required) IPv6 address of server to proxy requests to. |
site string |
(Optional) Name of the site to configure proxy servers in, or |
proxy_protocol boolean |
(Optional) Whether to use PROXY Protocol when proxying requests (default: |
Example
application/json
{
"endpoints": [
{
"domain": "example.com",
"hostname": "www",
"address": "2a00:1098:0:82:1000:3b:1:1",
"site": "all",
"proxy_protocol": true
}
]
}
Responses
Code | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | List of endpoints application/json
Example
|
||||||||||||||
400 | Bad input | ||||||||||||||
401 | Not authenticated | ||||||||||||||
403 | Not authorised |
post /endpoints/{domain}/{hostname}
This creates additional endpoints for the specified domain and hostname. Unlike an equivalent PUT
request, existing endpoints will not be replaced.
Request Body JSON
Name | Description |
---|---|
endpoints array |
(Required) List of endpoints to add. |
address string |
(Required) IPv6 address of server to proxy requests to. |
site string |
(Optional) Name of the site to configure proxy servers in, or |
proxy_protocol boolean |
(Optional) Whether to use PROXY Protocol when proxying requests (default: |
Example
application/json
{
"endpoints": [
{
"domain": "example.com",
"hostname": "www",
"address": "2a00:1098:0:82:1000:3b:1:1",
"site": "all",
"proxy_protocol": true
}
]
}
Responses
Code | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | List of endpoints application/json
Example
|
||||||||||||||
400 | Bad input | ||||||||||||||
401 | Not authenticated | ||||||||||||||
403 | Not authorised |
delete /endpoints/{domain}/{hostname}
delete /endpoints/{domain}/{hostname}/{address}
delete /endpoints/{domain}/{hostname}/{address}/{site}
This will delete all endpoints matching the URL path.
Responses
Code | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | List of endpoints application/json
Example
|
||||||||||||||
400 | Bad input | ||||||||||||||
401 | Not authenticated | ||||||||||||||
403 | Not authorised |
get /sites
Lists the available sites with proxy servers.
Responses
Code | Description | ||||
---|---|---|---|---|---|
200 | List of sites application/json
Example
|
Common errors
Code | Description | ||||||
---|---|---|---|---|---|---|---|
400 | Request cannot be completed due to an error in input. application/json
Example
|
||||||
401 | User is not authenticated. application/json
Example
|
||||||
403 | Not authorised to access this API. application/json
Example
|