---
title: "Create a settlement"
url: "https://nexora.apim.eu/apis/chargeback-settlement/versions/109ed889-6e58-4a7d-be59-d2717eab4852/operations/createSettlement"
---

> Full API specification: https://nexora.apim.eu/apis/chargeback-settlement/versions/109ed889-6e58-4a7d-be59-d2717eab4852.md

# Create a settlement

`POST` `/settlements`

Operation ID: `createSettlement`

Creates the settlement for a completed billing period. The basis is the metered usage cost for that period.

## Request body (required)

Content types: `application/json`

## Responses

- `201` - Created
- `400` - The request doesn't match the schema
- `401` - Key is missing, revoked or invalid
- `422` - Chargeback rate not permitted

## OpenAPI definition

```yaml
openapi: 3.0.3
info:
  title: Usage Chargeback & Settlement
  version: 1.0.0
servers:
  - url: https://api.nexora.example/v1
    description: Production
  - url: https://sandbox.api.nexora.example/v1
    description: Sandbox
paths:
  /settlements:
    post:
      tags:
        - Settlements
      summary: Create a settlement
      description: |
        Creates the settlement for a completed billing period. The basis is
        the metered usage cost for that period.
      operationId: createSettlement
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SettlementCreate"
            example:
              agent_id: agt_8f2c1a
              usage_type: standard
              billing_basis_usd: 6380
              chargeback_rate_percent: 12
              period_end_date: 2026-08-31
              cost_center:
                name: Customer Success
                cost_center_id: CC-4021
                business_unit: Support Engineering
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Settlement"
              example:
                id: stl_7c53
                agent_id: agt_8f2c1a
                status: open
                usage_type: standard
                billing_basis_usd: 6380
                line_items:
                  - payer: consuming_team
                    rate_percent: 12
                    net_usd: 765.6
                    overhead_usd: 61.25
                    total_usd: 826.85
                due_date: 2026-09-14
        "400":
          $ref: "#/components/responses/ValidationError"
        "401":
          $ref: "#/components/responses/NotAuthenticated"
        "422":
          description: Chargeback rate not permitted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
              example:
                code: chargeback_rate_not_permitted
                message: The chargeback rate exceeds the business unit's approved ceiling.
                details:
                  - field: chargeback_rate_percent
                    reason: exceeds_ceiling
security:
  - apiKey: []
components:
  schemas:
    SettlementCreate:
      type: object
      required:
        - agent_id
        - usage_type
        - billing_basis_usd
        - chargeback_rate_percent
        - period_end_date
      properties:
        agent_id:
          type: string
          example: agt_8f2c1a
        usage_type:
          $ref: "#/components/schemas/UsageType"
        billing_basis_usd:
          type: number
          format: float
          description: Total metered usage cost for the billing period, before the
            chargeback rate is applied.
          example: 6380
        chargeback_rate_percent:
          type: number
          format: float
          example: 12
        period_end_date:
          type: string
          format: date
          example: 2026-08-31
        cost_center:
          $ref: "#/components/schemas/CostCenter"
    Settlement:
      type: object
      properties:
        id:
          type: string
          example: stl_7c53
        agent_id:
          type: string
          example: agt_8f2c1a
        status:
          $ref: "#/components/schemas/SettlementStatus"
        usage_type:
          $ref: "#/components/schemas/UsageType"
        billing_basis_usd:
          type: number
          format: float
          example: 6380
        line_items:
          type: array
          items:
            $ref: "#/components/schemas/LineItem"
        invoice_id:
          type: string
          example: inv_a920
        due_date:
          type: string
          format: date
          example: 2026-09-14
        paid_usd:
          type: number
          format: float
          example: 0
        created_at:
          type: string
          format: date-time
          example: 2026-08-15T07:30:00Z
    Error:
      type: object
      description: Uniform error format across all Nexora AI APIs.
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: validation_failed
        message:
          type: string
          example: The billing basis is required to calculate the chargeback.
        details:
          type: array
          items:
            $ref: "#/components/schemas/ErrorDetail"
    UsageType:
      type: string
      enum:
        - standard
        - burst
        - reserved
      example: standard
    CostCenter:
      type: object
      properties:
        name:
          type: string
          example: Customer Success
        cost_center_id:
          type: string
          example: CC-4021
        business_unit:
          type: string
          example: Support Engineering
    SettlementStatus:
      type: string
      enum:
        - draft
        - open
        - partially_paid
        - paid
        - canceled
      example: open
    LineItem:
      type: object
      properties:
        payer:
          type: string
          enum:
            - consuming_team
            - platform_subsidy
            - partner_cost_center
            - shared_services
        rate_percent:
          type: number
          format: float
          example: 12
        net_usd:
          type: number
          format: float
          example: 765.6
        overhead_usd:
          type: number
          format: float
          example: 61.25
        total_usd:
          type: number
          format: float
          example: 826.85
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
          example: chargeback_rate_percent
        reason:
          type: string
          example: missing
  responses:
    ValidationError:
      description: The request doesn't match the schema
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    NotAuthenticated:
      description: Key is missing, revoked or invalid
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apikey
      description: |
        Every call carries an API key in the `apikey` header. You generate the
        key in the Nexora AI portal under "My Apps"; it's shown exactly once.

        Each key has the scopes it's allowed to use attached to it. If one is
        missing, the API responds with `403` and `code: "scope_missing"`; the
        missing scope is in `details[].field`.
```
