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

# Create rate

> Adds a rate after the currently active rate, with a unique effective timestamp.

> [!NOTE]
>
> API v2 is in beta. Endpoints return the `X-Lago-Endpoint-Status: beta` header.


## OpenAPI

````yaml https://swagger.getlago.com/openapi-v2.yaml POST /rate_cards/{rate_card_code}/rates
openapi: 3.1.0
info:
  title: Lago API v2 documentation
  description: >-
    Lago API v2. Documents native v2 endpoints for the product catalog, billing,
    customers, organizations, billing entities, billable metrics, events,
    features, privileges, entitlements, wallets, alerts, logs and webhook
    endpoints. Paginated lists use cursor pagination. Some lists, such as rates
    and phases, return the complete list without pagination. Native v2 endpoints
    use opt-in relationship expansions and structured error responses. Only the
    documented actions and expansions are supported. Some other /api/v2 paths
    still fall back to v1 controllers and are not described here.
  version: 2.0.0-beta
  license:
    name: AGPLv3
    url: https://github.com/getlago/lago-openapi/blob/main/LICENSE
  contact:
    email: tech@getlago.com
servers:
  - url: https://api.getlago.com/api/v2
    description: US Lago cluster
  - url: https://api.eu.getlago.com/api/v2
    description: EU Lago cluster
security:
  - bearerAuth: []
tags:
  - name: taxes
    description: Tax rates
  - name: product_categories
    description: product categories operations
  - name: products
    description: products operations
  - name: product_filters
    description: product filters operations
  - name: rate_cards
    description: rate cards operations
  - name: rate_card_rates
    description: rate card rates operations
  - name: catalog_plans
    description: catalog plans operations
  - name: plan_applied_rate_cards
    description: plan applied rate cards operations
  - name: plan_rate_phases
    description: plan rate phases operations
  - name: contract_applied_rate_cards
    description: contract applied rate cards operations
  - name: contract_rate_phases
    description: contract rate phases operations
  - name: contracts
    description: contracts operations
  - name: invoices
    description: invoices operations
  - name: fees
    description: fees operations
  - name: payments
    description: payments operations
  - name: payment_requests
    description: payment requests operations
  - name: payment_receipts
    description: payment receipts operations
  - name: credit_notes
    description: credit notes operations
  - name: customers
    description: customers operations
  - name: organizations
    description: Organization operations
  - name: billing_entities
    description: billing entities operations
  - name: billable_metrics
    description: billable metrics operations
  - name: events
    description: Event operations
  - name: activity_logs
    description: activity logs operations
  - name: api_logs
    description: api logs operations
  - name: security_logs
    description: security logs operations
  - name: webhook_endpoints
    description: webhook endpoints operations
  - name: features
    description: features operations
  - name: feature_privileges
    description: feature privileges operations
  - name: plan_wallets
    description: plan wallets operations
  - name: contract_wallets
    description: contract wallets operations
  - name: contract_wallet_transactions
    description: contract wallet transactions operations
  - name: plan_wallet_alerts
    description: plan wallet alerts operations
  - name: contract_wallet_alerts
    description: contract wallet alerts operations
  - name: contract_alerts
    description: contract alerts operations
  - name: plan_entitlements
    description: plan entitlements operations
  - name: contract_entitlements
    description: contract entitlements operations
externalDocs:
  description: Lago documentation
  url: https://getlago.com/docs
paths:
  /rate_cards/{rate_card_code}/rates:
    parameters:
      - name: rate_card_code
        in: path
        required: true
        description: Rate card code.
        schema:
          type: string
          description: Rate card code.
          example: example_code
    post:
      tags:
        - rate_card_rates
      summary: Create rate
      description: >-
        Adds a rate after the currently active rate, with a unique effective
        timestamp. Amount and range fields must match rate_model.

        Requires the product catalog to be enabled and rate_card write
        permission on the API key.
      operationId: createRateCardRate
      requestBody:
        required: true
        description: Request payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RateCardRateCreateInput'
      responses:
        '200':
          description: Successful response
          headers:
            X-Lago-Endpoint-Status:
              $ref: '#/components/headers/EndpointStatus'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateCardRate'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
components:
  schemas:
    RateCardRateCreateInput:
      type: object
      description: Create rate.
      required:
        - rate
      properties:
        rate:
          allOf:
            - $ref: '#/components/schemas/RateCardRateBaseInput'
            - type: object
              required:
                - code
                - effective_from
                - rate_model
                - billing_interval_unit
    RateCardRate:
      type: object
      description: rate response.
      required:
        - rate
      properties:
        rate:
          $ref: '#/components/schemas/RateCardRateObject'
    RateCardRateBaseInput:
      type: object
      minProperties: 1
      properties:
        code:
          type: string
          description: Code unique within the rate card.
          example: standard_2030
          pattern: ^(?!\.+$)[a-zA-Z0-9_\-.]+$
        effective_from:
          type: string
          description: >-
            Effective timestamp. It cannot be before today in the organization
            timezone, must be unique on the card, and must be after the active
            rate. Arrears rates start at the beginning of the day.
          example: '2030-01-01T00:00:00Z'
          format: date-time
        rate_model:
          type: string
          description: >-
            Pricing model. Fixed products support standard, graduated and
            volume. Volume cannot be billed in advance; dynamic requires a sum
            metric. Proration and aggregation can impose further restrictions.
          example: standard
          enum:
            - standard
            - graduated
            - package
            - percentage
            - volume
            - graduated_percentage
            - custom
            - dynamic
        rate_properties:
          $ref: '#/components/schemas/RatePropertiesInput'
        min_amount_cents:
          type: integer
          description: >-
            Minimum charge in cents. Allowed only for arrears billing. Defaults
            to 0 on creation.
          example: 0
          minimum: 0
        billing_interval_count:
          type: integer
          description: Number of billing interval units. Defaults to 1 on creation.
          example: 1
          minimum: 1
        billing_interval_unit:
          type: string
          description: Unit of the billing interval.
          example: day
          enum:
            - day
            - week
            - month
            - year
        applied_pricing_unit_conversion_rate:
          type:
            - string
            - 'null'
          description: >-
            Conversion rate for the applied pricing unit. Required when the card
            uses a pricing unit. Sent as a decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
    RateCardRateObject:
      type: object
      description: Rate Card Rate.
      required:
        - lago_id
        - code
        - rate_card_code
        - status
        - rate_model
        - rate_properties
        - min_amount_cents
        - billing_interval_count
        - billing_interval_unit
        - applied_pricing_unit_conversion_rate
        - effective_from
        - created_at
        - updated_at
        - deleted_at
      properties:
        lago_id:
          type: string
          description: Unique identifier created by Lago.
          example: 1a901a90-1a90-1a90-1a90-1a901a901a90
          format: uuid
        code:
          type: string
          description: Code.
          example: example
        rate_card_code:
          type:
            - string
            - 'null'
          description: Code of the parent rate card.
          example: compute_usd
        status:
          type: string
          description: Status derived from the effective-dated rate timeline.
          example: pending
          enum:
            - pending
            - active
            - terminated
        rate_model:
          type: string
          description: >-
            Pricing model. Fixed products support standard, graduated and
            volume. Volume cannot be billed in advance; dynamic requires a sum
            metric. Proration and aggregation can impose further restrictions.
          example: standard
          enum:
            - standard
            - graduated
            - package
            - percentage
            - volume
            - graduated_percentage
            - custom
            - dynamic
        rate_properties:
          $ref: '#/components/schemas/RatePropertiesObject'
        min_amount_cents:
          type: integer
          description: Minimum amount, in cents.
          example: 100
        billing_interval_count:
          type: integer
          description: Billing interval count.
          example: 1
        billing_interval_unit:
          type: string
          description: Unit of the billing interval.
          example: day
          enum:
            - day
            - week
            - month
            - year
        applied_pricing_unit_conversion_rate:
          type:
            - string
            - 'null'
          description: Applied pricing unit conversion rate. Sent as a decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        effective_from:
          type: string
          description: Effective from.
          example: '2022-04-29T08:59:51.123456Z'
          format: date-time
        created_at:
          type: string
          format: date-time
          description: UTC creation timestamp, with microsecond precision.
          example: '2022-04-29T08:59:51.123456Z'
        updated_at:
          type: string
          description: UTC timestamp of the last update, with microsecond precision.
          example: '2022-04-29T08:59:51.123456Z'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          description: >-
            UTC deletion timestamp, with microsecond precision. Null until
            deletion.
          example: null
          format: date-time
    ApiError:
      type: object
      required:
        - code
        - details
      properties:
        code:
          type: string
          pattern: ^[a-z][a-z0-9_]*$
          description: >-
            Code identifying the failure. The HTTP status is carried by the
            response, not the body.
          example: validation_errors
        details:
          type: array
          description: >-
            Details of the failure. The array is empty when no field details are
            available.
          items:
            type: object
            required:
              - code
              - field
              - meta
            properties:
              code:
                type: string
                pattern: ^[a-z][a-z0-9_]*$
                description: >-
                  Code identifying the field error or the reason a request
                  parameter was rejected.
                example: value_is_mandatory
              field:
                type: string
                description: >-
                  Request field or parameter. Nested fields use dots and
                  zero-based array indexes. A resource-level failure uses base.
                example: name
              meta:
                type: object
                description: >-
                  Information about the failure, such as the missing resource,
                  allowed values or bounds. The object is empty when no metadata
                  is available.
                additionalProperties: true
                example: {}
                properties:
                  min:
                    type: integer
                    description: Inclusive minimum value.
                    example: 0
                  max:
                    type: integer
                    description: Inclusive maximum value.
                    example: 100
                  min_length:
                    type: integer
                    description: Minimum string length, in characters.
                    example: 1
                  max_length:
                    type: integer
                    description: Maximum string length, in characters.
                    example: 255
                  max_items:
                    type: integer
                    description: Maximum number of items.
                    example: 100
                  allowed_values:
                    type: array
                    description: Values accepted for the field.
                    items:
                      type: string
                      description: Allowed value.
                      example: draft
                  invalid_values:
                    type: array
                    description: Values rejected by request validation.
                    items:
                      type: string
                      description: Rejected value.
                      example: unknown
                  value:
                    type: string
                    description: Query parameter value received.
                    example: unknown
                  resource:
                    type: string
                    description: Resource that could not be found.
                    example: customer
                  provider_name:
                    type: string
                    description: Name of the provider that failed.
                    example: stripe
                  provider_code:
                    type: string
                    description: Code of the provider connection.
                    example: stripe_eu
                  provider_error_code:
                    type: string
                    description: Error code returned by the provider.
                    example: resource_missing
    RatePropertiesInput:
      type: object
      description: >-
        Pricing configuration for the selected rate model. Standard requires
        amount; package also requires package_size. Graduated, volume and
        graduated_percentage models use their matching ranges array. Custom
        properties remain model-specific.
      not:
        required:
          - pricing_group_keys
        properties:
          pricing_group_keys: {}
      properties:
        amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        free_units:
          type: integer
          description: Free units per billing period.
          example: 0
        package_size:
          type: integer
          description: Units in one package.
          example: 100
        rate:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        fixed_amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        free_units_per_events:
          type:
            - integer
            - 'null'
          description: Number of free transactions.
          example: 0
        free_units_per_total_aggregation:
          type:
            - number
            - string
            - 'null'
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        per_transaction_min_amount:
          type:
            - number
            - string
            - 'null'
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        per_transaction_max_amount:
          type:
            - number
            - string
            - 'null'
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        graduated_ranges:
          type: array
          description: Ordered pricing tiers. The final tier is open-ended.
          items:
            $ref: '#/components/schemas/RateTierInput'
        volume_ranges:
          type: array
          description: Ordered pricing tiers. The final tier is open-ended.
          items:
            $ref: '#/components/schemas/RateTierInput'
        graduated_percentage_ranges:
          type: array
          description: Ordered pricing tiers. The final tier is open-ended.
          items:
            $ref: '#/components/schemas/RateTierInput'
      additionalProperties: true
    RatePropertiesObject:
      type: object
      description: >-
        Pricing configuration for the selected rate model. Standard requires
        amount; package also requires package_size. Graduated, volume and
        graduated_percentage models use their matching ranges array. Custom
        properties remain model-specific.
      not:
        required:
          - pricing_group_keys
        properties:
          pricing_group_keys: {}
      properties:
        amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        free_units:
          type: integer
          description: Free units per billing period.
          example: 0
        package_size:
          type: integer
          description: Units in one package.
          example: 100
        rate:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        fixed_amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        free_units_per_events:
          type:
            - integer
            - 'null'
          description: Number of free transactions.
          example: 0
        free_units_per_total_aggregation:
          type:
            - number
            - string
            - 'null'
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        per_transaction_min_amount:
          type:
            - number
            - string
            - 'null'
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        per_transaction_max_amount:
          type:
            - number
            - string
            - 'null'
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        graduated_ranges:
          type: array
          description: Ordered pricing tiers. The final tier is open-ended.
          items:
            $ref: '#/components/schemas/RateTierObject'
        volume_ranges:
          type: array
          description: Ordered pricing tiers. The final tier is open-ended.
          items:
            $ref: '#/components/schemas/RateTierObject'
        graduated_percentage_ranges:
          type: array
          description: Ordered pricing tiers. The final tier is open-ended.
          items:
            $ref: '#/components/schemas/RateTierObject'
      additionalProperties: true
    RateTierInput:
      type: object
      description: >-
        Pricing tier. Upper bounds must increase and the final tier must have a
        null upper bound. Do not send from_value.
      not:
        required:
          - from_value
        properties:
          from_value: {}
      properties:
        to_value:
          type:
            - string
            - number
            - 'null'
          description: >-
            Upper bound of this tier, sent as a decimal string. Null marks the
            final, open-ended tier.
          example: null
        flat_amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        per_unit_amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        rate:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
    RateTierObject:
      type: object
      description: >-
        Pricing tier. Its lower bound is the preceding upper bound; from_value
        is not returned.
      required:
        - to_value
      properties:
        to_value:
          type:
            - string
            - 'null'
          description: >-
            Upper bound of this tier, sent as a decimal string. Null marks the
            final, open-ended tier.
          example: null
        flat_amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        per_unit_amount:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
        rate:
          type:
            - number
            - string
          description: Amount, as a number or decimal string.
          example: '1.5'
          pattern: ^-?[0-9]+(\.[0-9]+)?$
  headers:
    EndpointStatus:
      description: Indicates that the endpoint is in beta.
      schema:
        type: string
        enum:
          - beta
        example: beta
  responses:
    BadRequest:
      description: Invalid request body, pagination or relationship expansion
      headers:
        X-Lago-Endpoint-Status:
          $ref: '#/components/headers/EndpointStatus'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            code: invalid_expand
            details:
              - code: malformed
                field: expands
                meta:
                  allowed_values: []
    Unauthorized:
      description: Missing or invalid API key
      headers:
        X-Lago-Endpoint-Status:
          $ref: '#/components/headers/EndpointStatus'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            code: unauthorized
            details: []
    Forbidden:
      description: Feature unavailable or insufficient API permissions
      headers:
        X-Lago-Endpoint-Status:
          $ref: '#/components/headers/EndpointStatus'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            code: feature_unavailable
            details: []
    NotFound:
      description: Unknown resource or resource from another organization
      headers:
        X-Lago-Endpoint-Status:
          $ref: '#/components/headers/EndpointStatus'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            code: resource_not_found
            details:
              - code: resource_not_found
                field: base
                meta:
                  resource: resource_name
    UnprocessableEntity:
      description: Invalid fields or filters
      headers:
        X-Lago-Endpoint-Status:
          $ref: '#/components/headers/EndpointStatus'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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