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

# Create price unit

> Use when defining a new unit of measure for pricing (e.g. GB, API call, seat). Ideal for metered or usage-based prices.



## OpenAPI

````yaml /api-reference/openapi.json post /prices/units
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /prices/units:
    post:
      tags:
        - Price Units
      summary: Create price unit
      description: >-
        Use when defining a new unit of measure for pricing (e.g. GB, API call,
        seat). Ideal for metered or usage-based prices.
      operationId: createPriceUnit
      requestBody:
        description: Price unit details
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePriceUnitRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePriceUnitResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreatePriceUnitRequest:
      required:
        - base_currency
        - code
        - conversion_rate
        - name
        - symbol
      type: object
      properties:
        base_currency:
          type: string
          description: base_currency  is the currency that the price unit is based on
        code:
          type: string
        conversion_rate:
          type: string
          description: >-
            ConversionRate defines the exchange rate from this price unit to the
            base currency.

            This rate is used to convert amounts in the custom price unit to the
            base currency for storage and billing.


            Conversion formula:
              price_unit_amount * conversion_rate = base_currency_amount

            Example:
              If conversion_rate = "0.01" and base_currency = "usd":
              100 price_unit tokens * 0.01 = 1.00 USD

            Note: Rounding precision is determined by the base currency (e.g.,
            USD uses 2 decimal places, JPY uses 0).
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          type: string
        symbol:
          type: string
    CreatePriceUnitResponse:
      type: object
      properties:
        base_currency:
          type: string
        code:
          type: string
        conversion_rate:
          type: string
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        environment_id:
          type: string
        id:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          type: string
        status:
          $ref: '#/components/schemas/types.Status'
        symbol:
          type: string
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    errors.ErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - not_found
            - already_exists
            - version_conflict
            - validation_error
            - invalid_operation
            - permission_denied
            - http_client_error
            - database_error
            - system_error
            - internal_error
            - service_unavailable
        details:
          type: object
          additionalProperties:
            type: object
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````