Custom Domains: Create

This documentation entry provides a clear guide for developers on how to create a new custom domain using the API, including the necessary parameters, headers, and expected response.

Endpoint

POST /api/domains

Create a new custom domain with the specified parameters.

Request

HTTP Request

POST https://uptimekeep.com/api/domains

Headers

Header
Type
Description

Authorization

String

Bearer token for API authentication.

Content-Type

String

Must be set to multipart/form-data for file uploads.

Parameters

Parameter
Type
Required
Description

host

String

Yes

The domain name (e.g., "domain.com").

custom_index_url

String

No

Custom URL for the index page (e.g., "https://mywebsite.com/").

custom_not_found_url

String

No

Custom URL for the 404 error page (e.g., "https://mywebsite.com/404-page").

Example of a request:

curl --request POST \
--url 'https://uptimekeep.com/api/domains' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: multipart/form-data' \
--form 'host=domain.com' \
--form 'custom_index_url=https://mywebsite.com/' \
--form 'custom_not_found_url=https://mywebsite.com/404-page'

Response

A successful response returns a JSON object containing the unique identifier of the newly created custom domain.

Response Example

Fields

Data Object

Field
Type
Description

id

Integer

Unique identifier for the new custom domain.

Errors

If the request fails, the API will return an error message with an appropriate HTTP status code, such as 400 Bad Request if required parameters are missing or invalid.

Last updated