Register
To be able to use the Prefetch Pageviews API, you need to register your domain and verify email id you would like to associate with it.
Verify Email Id
Once register api call is made, a email will be triggered to verify the emailId supplied. Only after the verification is completed within one hour
, you can start using the Prefetch Pageviews API.
If verification link is expired, you need to start with registering your app again. Once verified, you can use the configure api to set the valid pages list.
Register Domain
Request
curl -X POST "https://prefetch.io/api/v1/register" \
-H "Content-Type: application/json" \
-d '{
"clientName": "test-client-1",
"domainName": "{{referer}}",
"emailId": "{{emailId}}"
}'
Response
{
"clientId": "1b7ec7d8-9211-46f2-b14f-14313ac4e275",
"clientSecret": "516698ca-8fef-4d93-afd8-2fc73aef6889"
}
Keep the clientId and clientSecret securely saved to prevent misuse of these.
Request Headers
- Content-Type:
application/json
- The request body must be in JSON format.
Request Body
The request body must be a JSON object containing the following parameters:
- clientName (required): A unique name for the client. This will identify the client in the system.
- domainName (required): The domain name associated with the client. This is the domain from which requests will originate.
- emailId (required): The email address associated with the client. This will be used for communication or account verification purposes.
Response Body
If the registration is successful, the API responds with a JSON object containing the new clientId
and clientSecret
. These credentials are necessary for making authenticated requests to the Prefetch API.
Example Response:
{
"clientId": "1b7ec7d8-9211-46f2-b14f-14313ac4e275",
"clientSecret": "516698ca-8fef-4d93-afd8-2fc73aef6889"
}
- clientId: A unique identifier for the client. This is used in subsequent API requests to authenticate the client.
- clientSecret: A secret key associated with the client. This should be kept secure and used for authentication when making API requests.
Success Response
- Status Code: 200 OK
- The response body will contain the newly generated
clientId
andclientSecret
.
- The response body will contain the newly generated
Error Responses
-
400 Bad Request:
- The request body is missing required parameters (e.g.,
clientName
,domainName
, oremailId
), or the body is malformed.
- The request body is missing required parameters (e.g.,
-
401 Unauthorized:
- If you are trying to register a client with invalid credentials (if authentication is required before registration).
-
409 Conflict:
- The
clientName
oremailId
is already in use. You must choose a different client name or email.
- The
-
500 Internal Server Error:
- The server encountered an error while processing the registration.
Notes:
- The
clientId
andclientSecret
are crucial for making authenticated API requests to Prefetch. Store these values securely. - If you lose your
clientSecret
, you may need to re-register the client or contact support.