# Create Analytics Subpage

Make a detail page that opens when a row or value of this panel is clicked. Its variables take the clicked row's same-named fields.

`POST https://connect.mindcloud.co/v2/analytics/pages/:pageId/panels/:panelId/subpages`

Permissions: `analytics:page:create`.

## Parameters

### Path

- `pageId` (string, required): The page the panel is on, from List Analytics Pages.
- `panelId` (string, required): The panel whose click opens the subpage, from Get Analytics Page.

### Headers

- `If-Match` (string, required): Required. The revision you last read: the `revision` from its read (Get Workflow Definition for a workflow, Get Analytics Page Definition for an Analytics page, Get Analytics Data Source Table for a fixed source's table), or `meta.revision` from your last change to it. The `ETag` header of either answer is the same value, ready to send back. The change applies only if nobody changed it since: otherwise it answers 412 with the current revision in `error.details.revision`. Send it as a strong entity tag (`"r_..."`): a weak one (`W/"..."`) never matches and answers 412. Without it the request answers 428.
- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. Here a key acts in another organization only as one of its members: with "Use this key across all of your organizations" on, in an organization its creator belongs to with a role. Child organizations and MindCloud staff access do not reach this endpoint. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

### Body

- `name` (string, required): What the subpage is called.
  What the subpage is called, such as "Customer detail".
- `description` (string): What it answers.
  One line under its title saying what it answers.
- `event` (string, required): The click that opens it.
  The unused click on the panel that opens it: rowClick, valueClick, or "button:<column key>" for a button column.
- `variables` (array): What the subpage receives from the click.
  The variables the subpage receives, in page order, as Set Analytics Page Variables takes them. A select takes the clicked row's field of the same name.

## Example request

```bash
curl --request POST \
  --url 'https://connect.mindcloud.co/v2/analytics/pages/Pq7Lm2Xc9RtA/panels/Kd4Rw8Zn1VbQ/subpages' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Customer detail",
  "description": "One customer and their orders",
  "event": "rowClick",
  "variables": [
    {
      "name": "customerId",
      "type": "select",
      "control": "none",
      "options": {
        "values": [
          {
            "value": "cus_8Hq2",
            "label": "Acme"
          }
        ]
      }
    }
  ]
}'
```

## Response fields

- `id` (string): The new subpage id. Get Analytics Page reads it.
- `name` (string): What the subpage is called.
- `description` (string): The line under its title.
- `parentPageId` (string): The page whose panel opens it, from List Analytics Pages.
- `parentPanelId` (string): The panel whose click opens it, from Get Analytics Page.
- `event` (string): The click on that panel that opens it, now wired to navigatePage.
- `createdOn` (date): When it was created.
