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

# Create Shipping Rate

> Creates a new shipping rate. The rate is a fixed amount denominated in USD. New shipping rates
are `active` by default.



## OpenAPI

````yaml /openapi.json post /v1/shipping_rates
openapi: 3.1.0
info:
  title: Flex API
  description: >-
    The Flex API powers HSA/FSA payment processing for healthcare commerce:
    checkout sessions, payment intents, subscriptions, customers, refunds,
    disputes, and eligibility. Authenticate with your partner API key as a
    Bearer token. All endpoints are scoped to your partner account, and test
    mode is fully supported via test API keys.
  version: 0.1.0
servers:
  - url: https://api.withflex.com
security:
  - BearerAuth: []
tags:
  - name: Balance Transactions
  - name: Captures
  - name: Checkout Sessions
  - name: Coupons
  - name: Customers
  - name: Disputes
  - name: Events
  - name: Exports
  - name: Files
  - name: Invoices
  - name: Letters
  - name: Orders
  - name: Payment Intents
  - name: Payment Links
  - name: Payouts
  - name: Prices
  - name: Products
  - name: Promo Codes
  - name: Receipts
  - name: Refunds
  - name: Setup Intents
  - name: Shipping Rates
  - name: Subscriptions
paths:
  /v1/shipping_rates:
    post:
      tags:
        - Shipping Rates
      summary: Create Shipping Rate
      description: >-
        Creates a new shipping rate. The rate is a fixed amount denominated in
        USD. New shipping rates

        are `active` by default.
      operationId: v1.shipping_rates.create
      requestBody:
        description: An envelope wrapping a single shipping rate object.
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/ShippingRateBody_for_CreateShippingRateRequest
            example:
              shipping_rate:
                display_name: Example
                amount: 2500
                metadata:
                  order_id: '8842'
                  channel: shopify
        required: true
      responses:
        '200':
          description: An envelope wrapping a single shipping rate object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShippingRateBody_for_V1ShippingRate'
              example:
                shipping_rate:
                  shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
                  active: false
                  display_name: Example
                  amount: 2500
                  metadata:
                    order_id: '8842'
                    channel: shopify
                  created_at: '2026-06-15T14:30:00Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
              example:
                detail:
                  - loc:
                      - string
                    msg: string
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
components:
  schemas:
    ShippingRateBody_for_CreateShippingRateRequest:
      description: An envelope wrapping a single shipping rate object.
      type: object
      required:
        - shipping_rate
      properties:
        shipping_rate:
          $ref: '#/components/schemas/CreateShippingRateRequest'
          description: The shipping rate.
      example:
        shipping_rate:
          display_name: Example
          amount: 2500
          metadata:
            order_id: '8842'
            channel: shopify
    ShippingRateBody_for_V1ShippingRate:
      description: An envelope wrapping a single shipping rate object.
      type: object
      required:
        - shipping_rate
      properties:
        shipping_rate:
          $ref: '#/components/schemas/V1ShippingRate'
          description: The shipping rate.
      example:
        shipping_rate:
          shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
          active: false
          display_name: Example
          amount: 2500
          metadata:
            order_id: '8842'
            channel: shopify
          created_at: '2026-06-15T14:30:00Z'
    HttpErrorOut:
      title: HttpError
      description: The error response returned when a request cannot be completed.
      type: object
      required:
        - code
        - detail
      properties:
        code:
          description: A short machine-readable error code identifying the type of error.
          type: string
        detail:
          description: A human-readable explanation of what went wrong.
          type: string
      example:
        code: string
        detail: string
    HTTPValidationError:
      description: The error response returned when request validation fails (HTTP 422).
      type: object
      required:
        - detail
      properties:
        detail:
          description: The list of validation errors, one entry per invalid field.
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      example:
        detail:
          - loc:
              - string
            msg: string
            type: string
    CreateShippingRateRequest:
      description: Parameters for creating a shipping rate.
      type: object
      required:
        - amount
        - display_name
      properties:
        display_name:
          description: >-
            The name shown to the customer at checkout (e.g., `Standard
            Shipping`). Must be at least 2 characters.
          type: string
          minLength: 2
          example: Example
        amount:
          description: >-
            The shipping cost, in the smallest currency unit (e.g., `500` =
            $5.00 USD). Charged in USD.
          type: integer
          format: int32
          example: 2500
        metadata:
          description: >-
            Set of key-value pairs you can attach to the shipping rate for
            storing additional structured information.
          type:
            - object
            - 'null'
          example:
            order_id: '8842'
            channel: shopify
      example:
        display_name: Example
        amount: 2500
        metadata:
          order_id: '8842'
          channel: shopify
    V1ShippingRate:
      description: >-
        A ShippingRate represents a fixed shipping cost you can apply to a
        checkout session. Each shipping rate is denominated in USD.
      type: object
      required:
        - active
        - amount
        - created_at
        - display_name
        - shipping_rate_id
      properties:
        shipping_rate_id:
          description: Unique identifier for the shipping rate.
          type: string
          example: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        active:
          description: >-
            Whether the shipping rate can be applied to new checkout sessions.
            Defaults to `true` on creation; set to `false` to archive it.
          type: boolean
          example: false
        display_name:
          description: >-
            The name shown to the customer at checkout (e.g., `Standard
            Shipping`).
          type: string
          example: Example
        amount:
          description: >-
            The shipping cost, in the smallest currency unit (e.g., `500` =
            $5.00 USD). Always in USD.
          type: integer
          format: int32
          example: 2500
        metadata:
          description: >-
            Set of key-value pairs you can attach to the shipping rate for
            storing additional structured information. Omitted when no metadata
            is set.
          type:
            - object
            - 'null'
          example:
            order_id: '8842'
            channel: shopify
        created_at:
          $ref: '#/components/schemas/Timestamptz'
          description: >-
            Time at which the shipping rate was created, as an RFC 3339
            timestamp.
          example: '2026-06-15T14:30:00Z'
      example:
        shipping_rate_id: fshr_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        active: false
        display_name: Example
        amount: 2500
        metadata:
          order_id: '8842'
          channel: shopify
        created_at: '2026-06-15T14:30:00Z'
    ValidationErrorItem:
      description: >-
        Validation errors have their own schema to provide context for invalid
        requests eg. mismatched types and out of bounds values. There may be any
        number of these per 422 UNPROCESSABLE ENTITY error.
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          description: >-
            The location as a [`Vec`] of [`String`]s -- often in the form
            `["body", "field_name"]`, `["query", "field_name"]`, etc. They may,
            however, be arbitarily deep.
          type: array
          items:
            type: string
        msg:
          description: The message accompanying the validation error item.
          type: string
        type:
          description: >-
            The type of error, often "type_error" or "value_error", but
            sometimes with more context like as "value_error.number.not_ge"
          type: string
      example:
        loc:
          - string
        msg: string
        type: string
    Timestamptz:
      description: >-
        A timestamp encoded as an RFC 3339 / ISO 8601 string (e.g.
        `2026-06-15T14:30:00Z`).
      type: string
      example: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use a Bearer token to access this API.

````