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

# Create a refund

> Issues a refund against a paid invoice. The refund may be queued for
review depending on the portal's billing configuration.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/refunds
openapi: 3.0.0
info:
  contact: {}
  title: Assembly API
  version: 0.0.1
servers:
  - url: https://api.assembly.com
security: []
paths:
  /v1/refunds:
    post:
      tags:
        - Refunds
      summary: Create a refund
      description: |-
        Issues a refund against a paid invoice. The refund may be queued for
        review depending on the portal's billing configuration.
      operationId: CreateRefund
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/refund.CreateRefundRequest'
        description: Refund to create
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/refund.Refund'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: >-
            Invalid request body or invoice cannot be refunded in its current
            state
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Missing or invalid API key
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Invoice not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Unexpected server error
      security:
        - APIKeyHeader: []
components:
  schemas:
    refund.CreateRefundRequest:
      properties:
        invoiceId:
          example: inv_123
          type: string
      required:
        - invoiceId
      type: object
    refund.Refund:
      properties:
        amount:
          description: >-
            Amount is the refunded amount in the smallest currency unit (e.g.
            cents).
          example: 5000
          type: integer
        completedAt:
          description: >-
            CompletedAt is the RFC 3339 timestamp at which the refund succeeded;
            absent until then.
          example: '2024-02-20T14:05:00Z'
          format: date-time
          type: string
        createdAt:
          type: string
        creatorId:
          type: string
        data:
          type: string
        failureReason:
          description: >-
            FailureReason is the reason the refund failed, populated only for
            failed refunds.
          example: insufficient_funds
          type: string
        id:
          type: string
        identityId:
          type: string
        invoiceId:
          description: InvoiceID is the ID of the invoice the refund was issued against.
          example: 550e8400-e29b-41d4-a716-446655440000
          format: uuid
          type: string
        object:
          type: string
        previousAttributes:
          additionalProperties: true
          type: object
        receiptKey:
          description: >-
            ReceiptKey is the storage key of the refund receipt, when one is
            available.
          example: receipts/re_1a2b3c.pdf
          type: string
        ref:
          type: string
        status:
          allOf:
            - $ref: '#/components/schemas/refund.RefundStatusType'
          description: >-
            Status is the current state of the refund as it progresses through
            processing.
          enum:
            - pending
            - succeeded
            - failed
          example: succeeded
        updatedAt:
          type: string
      type: object
    dispatcher.Error:
      properties:
        code:
          type: string
        data: {}
        message:
          type: string
      type: object
    refund.RefundStatusType:
      enum:
        - pending
        - succeeded
        - failed
      type: string
      x-enum-varnames:
        - RefundStatusPending
        - RefundStatusSucceeded
        - RefundStatusFailed
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-KEY
      type: apiKey

````