PilotFoxDocs

Create a site

POST
/api/v1/orgs/{orgId}/sites

A new site of the organization. domain is stored as its host (and port, if any): scheme, path and query dropped, lowercased, an international name as punycode. timezone is an IANA name (UTC by default), kind is web (default) or app, and settings is applied over the defaults. Creating it public (settings.public: true) also needs the caller's own analytics:read (403 otherwise, and nothing is created). Answers the site as GET /sites/{siteId} shows it to the caller.

Requires site:create in the organization (an API key, or a signed-in member's role; a member restricted to some sites holds a viewer's permissions here). API keys limited to some sites: 403. Share links: 401.

Authorization

headerx-api-key<token>

An organization API key (ak_…), with the permissions and the sites it was created with. For servers and scripts: no cookie and no Origin check. Also accepted as Authorization: Bearer ak_… (apiKeyBearer). A request carries one credential: a key sent with a share token or a live session cookie is 400 (details.reason: ambiguous_credentials).

Scope: site:create

Path Parameters

orgId*string

Request Body

application/json
  1. body
name*string
Length1 <= length <= 100
domain*string
kind?string
Value in"web""app"
timezone?string
settings?

Response Body

Created

application/json
  1. response
data*|
Example Request
curl -X POST 'https://pilotfox.app/api/v1/orgs/string/sites' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "domain": "string"}'
Example Response201
{  "data": {    "id": "string",    "name": "string",    "domain": "string",    "timezone": "string",    "kind": "web",    "settings": {      "tracking": {        "initialPageview": true,        "spa": true,        "hashRouting": false,        "querystring": true,        "outbound": true,        "clicks": false,        "forms": false,        "copy": false,        "inputs": false,        "errors": false,        "vitals": false,        "paymentLinks": true      },      "replay": {        "enabled": false,        "sampleRate": 100,        "maskAllInputs": true,        "maskTextSelector": null,        "blockSelector": null,        "minDurationSeconds": 0      },      "identity": {        "mode": "stable"      },      "privacy": {        "storeQuerystringParams": "all",        "stripParams": [],        "respectGpc": true      },      "allowedHostnames": [],      "exclusions": {        "ips": [],        "countries": [],        "paths": [],        "userAgents": [],        "asns": []      },      "bots": {        "block": true      },      "revenue": {        "currency": "usd",        "storeCustomerEmail": false,        "attributionModel": "last_non_direct",        "attributionWindowDays": 90      },      "affiliates": {        "params": [          "ref"        ],        "windowDays": 30      },      "public": false,      "primaryGoalId": null    },    "createdAt": "2019-08-24T14:15:22Z",    "role": "owner",    "permissions": {      "property1": [        "string"      ],      "property2": [        "string"      ]    }  }}