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

# Create or update a product and its dimensions

> Sets up a product and its dimensions in one call, in one transaction: the product found by its `name` (`match=name`), created when there is none (a new product needs `period`); each dimension found by its key (`key`, or the one its name makes), created when the product has none, updated when it does. Dimensions not named are left as they are. A key another product's dimension holds, or a value type a dimension's stored values would not read as, refuses the whole call (409) and writes nothing. Answers 201 when it created the product, 200 when it updated it. Needs products:create and products:update.



## OpenAPI

````yaml /api/statisfy-api.openapi.json put /v1/products
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/products:
    put:
      tags:
        - products
      summary: Create or update a product and its dimensions
      description: >-
        Sets up a product and its dimensions in one call, in one transaction:
        the product found by its `name` (`match=name`), created when there is
        none (a new product needs `period`); each dimension found by its key
        (`key`, or the one its name makes), created when the product has none,
        updated when it does. Dimensions not named are left as they are. A key
        another product's dimension holds, or a value type a dimension's stored
        values would not read as, refuses the whole call (409) and writes
        nothing. Answers 201 when it created the product, 200 when it updated
        it. Needs products:create and products:update.
      operationId: products_upsert
      parameters:
        - description: 'What finds the product: its name'
          in: query
          name: match
          required: true
          schema:
            const: name
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                date_column:
                  default: null
                  maxLength: 200
                  title: Date Column
                  type: string
                date_format:
                  default: null
                  enum:
                    - '%Y-%m-%d'
                    - '%m/%Y'
                    - '%Y'
                    - '%m-%Y'
                    - '%Y/%m/%d'
                    - '%d/%m/%Y'
                    - '%m/%d/%Y'
                    - '%Y-%m'
                  title: Date Format
                  type: string
                dimensions:
                  items:
                    $ref: '#/components/schemas/NewDimension'
                  maxItems: 500
                  title: Dimensions
                  type: array
                display_name:
                  anyOf:
                    - maxLength: 200
                      type: string
                    - type: 'null'
                  default: null
                  description: null clears it
                  title: Display Name
                name:
                  maxLength: 200
                  minLength: 1
                  title: Name
                  type: string
                period:
                  default: null
                  enum:
                    - DAILY
                    - WEEKLY
                    - MONTHLY
                    - QUARTERLY
                    - YEARLY
                    - SINGLE
                  title: Period
                  type: string
                show_if_empty:
                  anyOf:
                    - type: boolean
                    - type: 'null'
                  default: null
                  description: 'null: follow the workspace''s setting'
                  title: Show If Empty
              required:
                - name
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedProduct'
          description: Successful Response
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpsertedProduct'
          description: Created
      security:
        - HTTPBearer: []
components:
  schemas:
    NewDimension:
      additionalProperties: false
      properties:
        currency:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Currency
        hidden:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Hidden
        key:
          anyOf:
            - pattern: ^[a-z0-9][a-z0-9_]{0,99}$
              type: string
            - type: 'null'
          default: null
          description: >-
            Lower-case letters, digits and underscores; made from the name when
            not sent
          title: Key
        name:
          maxLength: 200
          minLength: 1
          title: Name
          type: string
        order:
          anyOf:
            - maximum: 10000
              minimum: 0
              type: integer
            - type: 'null'
          default: null
          title: Order
        show_change:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Show Change
        suffix:
          anyOf:
            - maxLength: 40
              type: string
            - type: 'null'
          default: null
          title: Suffix
        type:
          default: null
          enum:
            - number
            - text
            - boolean
            - date
            - percent
            - ratio
          title: Type
          type: string
      required:
        - name
      title: NewDimension
      type: object
    UpsertedProduct:
      properties:
        date_column:
          anyOf:
            - type: string
            - type: 'null'
          description: The column usage dates come in, in a data feed
          title: Date Column
        date_format:
          anyOf:
            - enum:
                - '%Y-%m-%d'
                - '%m/%Y'
                - '%Y'
                - '%m-%Y'
                - '%Y/%m/%d'
                - '%d/%m/%Y'
                - '%m/%d/%Y'
                - '%Y-%m'
              type: string
            - type: 'null'
          description: >-
            The format usage dates are written in; null when not set or not one
            this API knows
          title: Date Format
        dimensions:
          description: In the order the app shows them
          items:
            $ref: '#/components/schemas/Dimension'
          title: Dimensions
          type: array
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
        id:
          title: Id
          type: string
        name:
          description: Unique across the workspace
          title: Name
          type: string
        period:
          anyOf:
            - enum:
                - DAILY
                - WEEKLY
                - MONTHLY
                - QUARTERLY
                - YEARLY
                - SINGLE
              type: string
            - type: 'null'
          description: >-
            The period its usage is reported for; usage written at another
            period does not show. Null when not set (the app reads it as
            MONTHLY) or not one this API knows
          title: Period
        result:
          enum:
            - created
            - updated
          title: Result
          type: string
        show_if_empty:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            Whether the app shows it on an account with no usage; null when not
            set, so it follows the workspace's setting (shown, unless the
            workspace changed it)
          title: Show If Empty
      required:
        - id
        - name
        - result
      title: UpsertedProduct
      type: object
    Dimension:
      properties:
        currency:
          default: false
          description: Whether the app shows values as money
          title: Currency
          type: boolean
        hidden:
          default: false
          description: Whether the app hides the dimension
          title: Hidden
          type: boolean
        id:
          title: Id
          type: string
        key:
          description: >-
            What usage data is matched on; unique across the workspace, and
            fixed
          title: Key
          type: string
        name:
          title: Name
          type: string
        order:
          anyOf:
            - type: integer
            - type: 'null'
          description: Its place among the product's dimensions; null for last
          title: Order
        product:
          description: The id of the product it measures
          title: Product
          type: string
        show_change:
          default: false
          description: Whether the app shows the change since the period before
          title: Show Change
          type: boolean
        suffix:
          anyOf:
            - type: string
            - type: 'null'
          description: Shown after a value, such as 'users'
          title: Suffix
        type:
          anyOf:
            - enum:
                - number
                - text
                - boolean
                - date
                - percent
                - ratio
              type: string
            - type: 'null'
          description: >-
            number, text, boolean, date, percent (0 to 100) or ratio (0 to 1);
            null for a type the app stores that this API does not know
          title: Type
      required:
        - id
        - product
        - key
        - name
      title: Dimension
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

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