> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upstackdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a dashboard view from a full configuration

> Create a dashboard view from a complete configuration, with attribution and date defaults, sections, and widgets placed at exact grid positions.

**Required scope:** `dashboards:write`

Use this when you need control over the exact layout. A common case is copying a
view between pixels: read it with [Get a dashboard view](https://docs.upstackdata.com/api-reference/dashboards/get-a-dashboard-view.md)
using the source pixel's key, then post its `type`, `name`, and `configuration` here
with the destination pixel's key. To get a dashboard from a list of measures without
placing each widget yourself, use
[Build a dashboard from a measure list](https://docs.upstackdata.com/api-reference/dashboards/build-a-dashboard-from-a-measure-list-preset.md).

## What the server checks

* `type`, `name` (1 to 200 characters), and `configuration` are required. `order`
  defaults to `0`.
* Inside `configuration`, the top-level fields and each section's fields are
  validated. Widget objects are saved exactly as sent, so check each widget's
  `layout` and `dataConfig` yourself. `widgets` must be present, even as an empty array.
* `attributionModel: "last_touch"` is accepted and saved as `last_click`.
* Names don't have to be unique, and every call creates a new view. Retrying a request
  that timed out can leave a duplicate, so list views before you retry.

## Response

The new view, including its `id`. `createdBy` and `updatedBy` are empty strings,
because writes made with an API key aren't attributed to a user. `type` is always
`view`. The dashboard type you sent comes back in `sk`.

## Related

* [Update a dashboard view](https://docs.upstackdata.com/api-reference/dashboards/update-a-dashboard-view.md) to change it later.
* [Duplicate a dashboard view](https://docs.upstackdata.com/api-reference/dashboards/duplicate-a-dashboard-view.md) to copy a view on the same pixel.
* [List available measures](https://docs.upstackdata.com/api-reference/catalog/list-available-measures.md) for the ids in `dataConfig.measures`.


## OpenAPI

````yaml /api-reference/openapi.yaml post /accounts/api/dashboard/views
openapi: 3.1.0
info:
  title: Upstack Data API
  version: '1.0'
  description: >
    Programmatic access to your Upstack Data pixel — analytics queries, the

    measures/dimensions catalog, and dashboard view management.


    All requests authenticate with two headers:


    - `x-api-key`: your Upstack API key (mint one at **Settings → API Keys** in
    the dashboard).

    - `x-pixel-id`: the pixel id the request targets. One key is scoped to one
    pixel.
servers:
  - url: https://api.upstackdata.com
    description: Production
security:
  - apiKey: []
    pixelId: []
tags:
  - name: Analytics
    description: >
      Run measure queries, attribution queries, cohort analyses, and ad-platform
      entity

      listings against your pixel's orders, events, and ad spend. Every query
      endpoint

      takes the same `filters` tree. [List filter
      fields](/api-reference/catalog/list-filter-fields)

      tells you which fields each endpoint accepts.
  - name: Catalog
    description: >
      Look up the ids the query and dashboard endpoints accept: the built-in
      measures, and

      the filter fields with the operators and endpoints each one supports.
  - name: Dashboards
    description: >
      Create, read, copy, update, and delete the dashboard views shown in the
      Upstack web app.

      A view belongs to the pixel in the `x-pixel-id` header, and a key can only
      see its own

      pixel's views.
  - name: Account
    description: >
      Read the account that owns the API key, rename it, and read or replace its
      order

      settings: whether pending and voided orders count, how refunds are dated,
      and which

      orders are excluded from reporting.
  - name: Costs
    description: >
      Read and update cost settings: product defaults, the shipping method, and
      cost lines

      for order fees, payment processing fees, shipping profiles, variable
      costs, and

      recurring expenses. Changes to costs that apply per order recalculate the
      past orders

      they affect, the same as an edit in the web app.
  - name: Products
    description: >
      Search the product variants synced from Shopify and manage per-variant
      costs: manual

      COG lines with effective dates, and handling fees.
  - name: Events
    description: >-
      Upstack Conversion API (CAPI) — send server-side tracking events from your
      backend.
paths:
  /accounts/api/dashboard/views:
    post:
      tags:
        - Dashboards
      summary: Create a dashboard view
      description: >-
        Create a dashboard view from a complete configuration, with attribution
        and date defaults, sections, and widgets placed at exact grid positions.
      operationId: createDashboardView
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - type
                - name
                - configuration
              properties:
                type:
                  $ref: '#/components/schemas/DashboardViewType'
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: Display name. Doesn't have to be unique.
                configuration:
                  $ref: '#/components/schemas/DashboardViewConfiguration'
                order:
                  type: integer
                  description: Sort position among the pixel's views. Defaults to `0`.
            examples:
              revenueTrend:
                summary: One full-width weekly net revenue chart
                value:
                  type: view
                  name: Weekly exec
                  order: 1
                  configuration:
                    attributionModel: last_click
                    attributionWindow: 7
                    granularity: week
                    dateRange:
                      start: '2026-03-01'
                      end: '2026-04-30'
                    grid:
                      maxWidth: 1200
                    widgets:
                      - id: 6b0f8a52-3c1d-4e7f-9a2b-5c8d1e4f7a90
                        title: Net revenue
                        chartType: line
                        layout:
                          x: 0
                          'y': 0
                          rows: 4
                          columns: 12
                          minColumns: 3
                          maxColumns: 12
                          minRows: 2
                          maxRows: 8
                          static: false
                        dataConfig:
                          measures:
                            - orders.net_revenue
                          dimensions: []
                          filters: []
      responses:
        '200':
          description: Created view.
          content:
            application/json:
              schema:
                type: object
                required:
                  - dashboardView
                properties:
                  dashboardView:
                    $ref: '#/components/schemas/DashboardView'
              examples:
                revenueTrend:
                  summary: The view created by the request example
                  value:
                    dashboardView:
                      pk: VIEW#01K7B4C6D8E0F2G4H6J8K0M2N4
                      sk: view
                      id: 01K7B4C6D8E0F2G4H6J8K0M2N4
                      pixelId: 5f1e6a4f-2b7c-4d1e-9a3f-8c6b2e0d4a71
                      type: view
                      name: Weekly exec
                      configuration:
                        attributionModel: last_click
                        attributionWindow: 7
                        granularity: week
                        dateRange:
                          start: '2026-03-01'
                          end: '2026-04-30'
                        grid:
                          maxWidth: 1200
                        widgets:
                          - id: 6b0f8a52-3c1d-4e7f-9a2b-5c8d1e4f7a90
                            title: Net revenue
                            chartType: line
                            layout:
                              x: 0
                              'y': 0
                              rows: 4
                              columns: 12
                              minColumns: 3
                              maxColumns: 12
                              minRows: 2
                              maxRows: 8
                              static: false
                            dataConfig:
                              measures:
                                - orders.net_revenue
                              dimensions: []
                              filters: []
                      order: 1
                      createdAt: '2026-10-12T15:42:08.311Z'
                      createdBy: ''
                      updatedAt: '2026-10-12T15:42:08.311Z'
                      updatedBy: ''
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    DashboardViewType:
      type: string
      enum:
        - view
        - attribution_view
        - pnl_view
      description: |
        Type of dashboard view.
        - `view`: the regular KPI dashboard.
        - `attribution_view`: the attribution dashboard.
        - `pnl_view`: the P&L dashboard.
    DashboardViewConfiguration:
      type: object
      required:
        - attributionModel
        - attributionWindow
        - granularity
        - dateRange
        - grid
        - widgets
      description: >
        Everything the web app needs to render a view. The server checks the
        top-level

        fields and each section's fields, but stores widget objects as sent, so
        a malformed

        widget is saved without an error.
      properties:
        attributionModel:
          allOf:
            - $ref: '#/components/schemas/AttributionModel'
          description: >-
            Default attribution model. The legacy value `last_touch` is accepted
            and saved as `last_click`.
        attributionWindow:
          type: integer
          description: Attribution lookback window in days.
        granularity:
          $ref: '#/components/schemas/Granularity'
        dateRange:
          $ref: '#/components/schemas/DateRange'
          description: Date range saved with the view.
        refundDateAttribution:
          allOf:
            - $ref: '#/components/schemas/RefundDateAttribution'
          description: Overrides the account-level setting for this view.
        filters:
          type: object
          description: >
            Date-picker / compare state (e.g. `{ preset: "last30", isCompare:
            false }`).

            Free-form; the in-app dashboard editor owns the shape.
        grid:
          type: object
          required:
            - maxWidth
          description: Grid settings for the widget layout.
          properties:
            maxWidth:
              type: integer
              description: Maximum grid width in pixels.
              example: 1200
        widgets:
          type: array
          description: |
            Flat array of all widgets across all sections. Dual-written: when
            `sections` is present, this array is a flattened mirror of the
            widgets inside each section (in section render order). Older
            consumers that read the flat list stay correct; clients writing
            the configuration should set both fields in sync.
          items:
            $ref: '#/components/schemas/DashboardWidget'
        sections:
          type: array
          description: >
            Authoritative grouping of widgets into labelled sections. When

            present, the web app renders sections in ordinal order (Pinned

            first via `ordinal: -1`), and uses each section's `widgets` for

            its content. Optional for backwards compatibility with views

            created before sections existed. Send a `sections` array with

            [Update a dashboard
            view](/api-reference/dashboards/update-a-dashboard-view)

            to migrate an older view.
          items:
            $ref: '#/components/schemas/DashboardSection'
        defaultSettings:
          $ref: '#/components/schemas/DashboardSectionSettings'
          description: |
            View-level defaults inherited by sections that don't override a
            given setting.
    DashboardView:
      type: object
      required:
        - id
        - pk
        - sk
        - pixelId
        - type
        - name
        - configuration
        - createdAt
        - updatedAt
        - createdBy
        - updatedBy
      properties:
        id:
          type: string
          description: >-
            The view id (a ULID). Use it as the `dashboardViewId` path
            parameter.
        pk:
          type: string
          description: Storage key, `VIEW#` followed by the view id. Ignore it.
        sk:
          allOf:
            - $ref: '#/components/schemas/DashboardViewType'
          description: >-
            The view's dashboard type (`view`, `attribution_view`, or
            `pnl_view`).
        pixelId:
          type: string
          description: The pixel that owns the view.
        type:
          type: string
          enum:
            - view
          description: Record kind, always `view`. Read `sk` for the dashboard type.
        name:
          type: string
          description: Display name.
        configuration:
          $ref: '#/components/schemas/DashboardViewConfiguration'
        order:
          type: integer
          description: Sort position among the pixel's views.
        createdAt:
          type: string
          format: date-time
          description: When the view was created.
        updatedAt:
          type: string
          format: date-time
          description: When the view was last changed.
        createdBy:
          type: string
          description: >-
            User id of the person who created the view. Empty string for views
            created with an API key.
        updatedBy:
          type: string
          description: >-
            User id of the last person to change the view. Empty string when the
            last change came from an API key.
    AttributionModel:
      type: string
      enum:
        - first_click
        - last_click
        - any_click
      description: Which touchpoint gets credit for a conversion.
    Granularity:
      type: string
      enum:
        - none
        - second
        - minute
        - hour
        - day
        - week
        - month
        - quarter
        - year
      description: >
        Time bucket for result rows. `none` returns one row per dimension
        combination

        instead of a time series.
    DateRange:
      type: object
      required:
        - start
        - end
      description: Inclusive date range. A date-only `end` covers that whole day.
      properties:
        start:
          type: string
          format: date
          description: First day of the range, as an ISO 8601 date.
          example: '2026-04-01'
        end:
          type: string
          format: date
          description: Last day of the range, as an ISO 8601 date. Included in the results.
          example: '2026-04-30'
    RefundDateAttribution:
      type: string
      enum:
        - refund_date
        - order_date
      description: >
        Which date a refund is counted on.

        - `refund_date`: the day the refund was processed, matching Shopify. The
        default.

        - `order_date`: the date of the original order.
    DashboardWidget:
      type: object
      required:
        - id
        - title
        - chartType
        - layout
        - dataConfig
      properties:
        id:
          type: string
        title:
          type: string
        chartType:
          $ref: '#/components/schemas/ChartType'
        layout:
          $ref: '#/components/schemas/WidgetLayout'
        dataConfig:
          type: object
          properties:
            measures:
              type: array
              items:
                type: string
              description: Canonical measure ids (e.g. `core.new_customer_roas`).
            dimensions:
              type: array
              items:
                type: string
            filters:
              type: array
              items:
                type: object
        sourceWidgetId:
          type: string
          description: |
            Present on widgets inside the Pinned section. Links the pinned copy
            back to the original widget id in the source section so unpin can
            resolve from either end.
    DashboardSection:
      type: object
      required:
        - id
        - title
        - ordinal
        - collapsed
        - hidden
        - layoutMode
        - widgets
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
          maxLength: 200
        ordinal:
          type: integer
          minimum: -1
          description: |
            Render order. The Pinned section uses `-1` (renders first);
            non-pinned sections use `0, 1, 2, …`. Clients should sort by
            ordinal and may renormalize to keep the sequence contiguous.
        collapsed:
          type: boolean
        hidden:
          type: boolean
        layoutMode:
          $ref: '#/components/schemas/SectionLayoutMode'
        sectionType:
          allOf:
            - $ref: '#/components/schemas/SectionType'
          description: Omit on normal sections; set to `pinned` for the Pinned section.
        catalogId:
          type: string
          enum:
            - custom_metrics
            - meta_ads
            - google_ads
            - tiktok_ads
            - expenses
            - web_analytics
            - store
            - attribution
          description: >-
            Set on sections added from the web app's section catalog. Omit on
            sections you create.
        settings:
          $ref: '#/components/schemas/DashboardSectionSettings'
        widgets:
          type: array
          items:
            $ref: '#/components/schemas/DashboardWidget'
    DashboardSectionSettings:
      type: object
      description: |
        Per-section overrides. Any field left undefined falls back to the
        view-level `defaultSettings` (and ultimately to product defaults).
      properties:
        density:
          $ref: '#/components/schemas/DashboardDensity'
        pacing:
          type: boolean
          description: Show pacing indicators on KPI widgets in this section.
        theme:
          type: string
          enum:
            - light
            - dark
          description: Widget color theme.
        backgroundColor:
          type: string
          maxLength: 50
          description: Section background color, as a CSS color string.
        headerStyle:
          $ref: '#/components/schemas/SectionHeaderStyle'
        filters:
          type: array
          description: >
            Saved per-section filters, in the web app's dashboard-filter format.
            This is

            not the `filters` tree the query endpoints take. Copy the value from
            a view you

            read with [Get a dashboard
            view](/api-reference/dashboards/get-a-dashboard-view)

            rather than building it by hand.
          items:
            type: object
            additionalProperties: true
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message.
        errors:
          type: array
          description: Per-field validation errors (present on 400 responses).
          items:
            type: object
            properties:
              message:
                type: string
              key:
                type: string
              path:
                type: array
                items:
                  type: string
    ChartType:
      type: string
      enum:
        - bar
        - line
        - sparkline
        - pie
        - scatter
        - area
        - dimensionTable
        - table
        - attributionTable
        - kpi
        - gauge
        - heatmap
        - histogram
        - boxplot
        - treemap
    WidgetLayout:
      type: object
      required:
        - x
        - 'y'
        - rows
        - columns
        - minColumns
        - maxColumns
        - minRows
        - maxRows
        - static
      properties:
        x:
          type: integer
          minimum: 0
          maximum: 11
        'y':
          type: integer
          minimum: 0
        rows:
          type: integer
          minimum: 1
        columns:
          type: integer
          minimum: 1
          maximum: 12
        minColumns:
          type: integer
          minimum: 1
        maxColumns:
          type: integer
          maximum: 12
        minRows:
          type: integer
          minimum: 1
        maxRows:
          type: integer
        static:
          type: boolean
    SectionLayoutMode:
      type: string
      enum:
        - auto
        - 1_column
        - 2_columns
        - 3_columns
        - 4_columns
      description: |
        How widgets are laid out inside a section. `auto` packs by add order;
        the `N_columns` variants force a fixed-column grid.
    SectionType:
      type: string
      enum:
        - default
        - pinned
      description: |
        Identifies the kind of section. `default` is a normal section (also
        the omitted value); `pinned` marks the special Pinned section, which
        always renders first (it carries `ordinal: -1`).
    DashboardDensity:
      type: string
      enum:
        - compact
        - normal
    SectionHeaderStyle:
      type: string
      enum:
        - default
        - minimal
        - accent
  responses:
    BadRequest:
      description: Validation error. Includes an `errors` array with per-field detail.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: >
        The `x-api-key` or `x-pixel-id` header is missing. The request is
        rejected

        before it reaches the API, and the body is `{"message":
        "Unauthorized"}`.

        A key that is present but not accepted returns `403`, not `401`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >
        The key was rejected, or it is valid but not allowed to do this. Either:


        - the key is unknown, revoked, or expired, or the pixel is inactive —
        the body is
          `{"Message": "User is not authorized to access this resource with an explicit deny
          in an identity-based policy"}` (note the capital `M`);
        - the key doesn't carry the scope this endpoint needs, or the body
        `pixelId` doesn't
          match the `x-pixel-id` header — the body is `{"message": "…"}` as described below.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Upstack API key. Starts with `upstack_`.
    pixelId:
      type: apiKey
      in: header
      name: x-pixel-id
      description: The pixel id the request targets.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.