Allowed domains & subdomains

With the following routes, you will be able to read, update and delete your default domain, your other domains & your subdomains through the API. ​

GET /settings/domain

This method will return your current default domain. ​

Resource URL

GET https://app.snipcart.com/api/settings/domain

Headers

Name Value Required? Description
Accept application/json Yes Our API only accepts application/json content type, so you must always specify Accept: application/json header in each request you make.
Example Request

curl -H "Accept: application/json" \
  https://app.snipcart.com/api/settings/domain \
  -u {API_KEY}

Example Response

{
  "domain":"snipcart.com",
  "protocol":"https"
}

PUT /settings/domain

This method will change your current default domain to the one specified in the parameter. ​

Resource URL

PUT https://app.snipcart.com/api/settings/domain

Headers

Name Value Required? Description
Accept application/json Yes Our API only accepts application/json content type, so you must always specify Accept: application/json header in each request you make.
Content-Type application/json Yes The request body needs to be JSON so we specify the content type
Parameters

Name Required? Type Description
Domain Yes string This will be your new default domain that will be associated with your account.
Protocol No, will be HTTP by default string Can be HTTPS or HTTP, if is not specified or different than that, the default value will be HTTP.

Example request

curl https://app.snipcart.com/api/settings/domain
  -X PUT \
  -H "Accept: application/json" \
  -H "Content-type: application/json" \
  -u {API_KEY} \
  -d "{'domain': 'snipcartnewdomain.com','protocol': 'https'}"

Example response

{
  "domain":"snipcartnewdomain.com",
  "protocol":"https"
}

GET /settings/alloweddomains

This method will return a list of every other allowed domains and subdomains other than your default website domain. ​

Resource URL

GET https://app.snipcart.com/api/settings/alloweddomains

Headers

Name Value Required? Description
Accept application/json Yes Our API only accepts application/json content type, so you must always specify Accept: application/json header in each request you make.
​ ​ Example Request

curl -H "Accept: application/json" \
  https://app.snipcart.com/api/settings/alloweddomains \
  -u {API_KEY}

Example response

[{
  "domain":"15ddef3a.ngrok.io",
  "protocol":"http"
},
{
  "domain":"subdomain.snipcart.com",
  "protocol":"https"
}]

POST /settings/alloweddomains

This method will ADD new domains or subdomains defined in the body. Note that the response will include every current domains and subdomains after adding the new ones. The default website domain won't be in the response. ​

Ressource URL

POST https://app.snipcart.com/api/settings/alloweddomains

Headers

Name Value Required? Description
Accept application/json Yes Our API only accepts application/json content type, so you must always specify Accept: application/json header in each request you make.
Content-Type application/json Yes The request body needs to be JSON so we specify the content type
Parameters

Name Required? Type Description
Array of {domain: 'value', protocol: 'value'} objects. Array format is required. Domain is required. Protocol is not and will take HTTP as default value. Array Objects respresenting a combination of domain and protocol have to be inside an array, even if you only have 1 domain to add.
​​

Example request

curl https://app.snipcart.com/api/settings/alloweddomains \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -u {API_KEY}\
  -d "[{'domain': 'subdomain1.snipcart.com'}, {'domain': 'snipalt.com', 'protocol': 'https'}]"

Example Response

[{
  "domain":"subdomain1.snipcart.com",
  "protocol":"http"
},
{
  "domain":"snipalt.com",
  "protocol":"https"
},
{
  "domain":"subdomain.snipcart.com",
  "protocol":"https"
}]

DELETE /settings/alloweddomains

This method will DELETE existing domains or subdomains defined in the body. Note that the response will include every current domains and subdomains after removing the ones specified. The default website domain won't be in the response. Also note that if domains to delete are not found among current allowed domains, our servers will return you BadRequest.

Resource URL

DELETE https://app.snipcart.com/api/settings/alloweddomains

Headers

Name Value Required? Description
Accept application/json Yes Our API only accepts application/json content type, so you must always specify Accept: application/json header in each request you make.
Content-Type application/json Yes The request body needs to be JSON so we specify the content type
Parameters

Name Required? Type Description
Array of {domain: 'value', protocol: 'value'} objects. Array format is required. Domain is required. Protocol is not and will take HTTP as default value. Array Objects respresenting a combination of domain and protocol have to be inside an array, even if you only have 1 domain to remove.
​​​

Example request

curl https://app.snipcart.com/api/settings/alloweddomains \
    -X Delete \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -u {API_KEY} \
    -d "[{'domain': 'subdomain1.snipcart.com'}, {'domain': 'snipalt.com', 'protocol': 'https'}]"

Example Response

[{
  "domain":"subdomain.snipcart.com",
  "protocol":"https"
}]