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

# Pay an Invoice

> Pays a pending invoice in full from account credit and returns the paid invoice. Add credit in the dashboard under Billing > Account credits.



## OpenAPI

````yaml /api-reference/openapi.json post /invoices/{invoice_id}/pay
openapi: 3.1.0
info:
  title: Arct Cloud API
  description: >-
    Manage Arct Cloud servers over HTTPS with an API token. Errors return an
    `error` object with `code`, `message` and `details`.
  version: 1.0.0
servers:
  - url: https://api.arct.cloud/v1
security: []
tags:
  - name: Account
    description: The account and token behind the request.
  - name: Account credit
    description: >-
      Credit transactions. Add credit in the dashboard under Billing > Account
      credits.
  - name: Servers
    description: List, read, create, update, power, reinstall, resize and delete servers.
  - name: Catalog
    description: Datacenters, locations, plans and OS images you can order.
  - name: Invoices
    description: Your invoices.
  - name: SSH Keys
    description: Keys to install on new and reinstalled servers.
paths:
  /invoices/{invoice_id}/pay:
    post:
      tags:
        - Invoices
      summary: Pay an Invoice
      description: >-
        Pays a pending invoice in full from account credit and returns the paid
        invoice. Add credit in the dashboard under Billing > Account credits.
      operationId: pay_invoice_invoices__invoice_id__pay_post
      parameters:
        - name: invoice_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Invoice Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayInvoiceRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '400':
          description: >-
            `credit_unavailable`, `invoice_not_payable` (not pending, or a
            resize invoice: resize with credit).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: '`invalid_token`, `token_disabled` or `token_expired`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: >-
            `insufficient_credit`; `details.shortfall` is the USD missing.
            Nothing charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: '`account_disabled`, `api_access_disabled` or `insufficient_scope`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: '`not_found`: unknown ID, or not yours.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            `payment_in_progress`: a card payment for this invoice is still
            running.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: '`validation_error`; see `details.fields`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: '`rate_limit_exceeded`; see `Retry-After`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: '`internal_error`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: '`billing_unavailable`. Nothing debited; retry later.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    PayInvoiceRequest:
      properties:
        payment_method:
          type: string
          const: credit
          title: Payment Method
          description: '`credit` pays the full total from account credit.'
      additionalProperties: false
      type: object
      required:
        - payment_method
      title: PayInvoiceRequest
    Invoice:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        invoice_number:
          type: string
          title: Invoice Number
        status:
          $ref: '#/components/schemas/InvoiceStatus'
        subtotal:
          type: number
          title: Subtotal
        tax:
          type: number
          title: Tax
        total:
          type: number
          title: Total
          description: Total, in USD.
        refunded_total:
          type: number
          title: Refunded Total
        period_start:
          type: string
          format: date-time
          title: Period Start
        period_end:
          type: string
          format: date-time
          title: Period End
        due_date:
          type: string
          format: date-time
          title: Due Date
        paid_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Paid At
        payment_method:
          anyOf:
            - type: string
            - type: 'null'
          title: Payment Method
        hosted_invoice_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Hosted Invoice Url
          description: Hosted invoice page, or null.
        created_at:
          type: string
          format: date-time
          title: Created At
        items:
          items:
            $ref: '#/components/schemas/InvoiceItem'
          type: array
          title: Items
      type: object
      required:
        - id
        - invoice_number
        - status
        - subtotal
        - tax
        - total
        - refunded_total
        - period_start
        - period_end
        - due_date
        - paid_at
        - payment_method
        - hosted_invoice_url
        - created_at
        - items
      title: Invoice
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorResponse
    InvoiceStatus:
      type: string
      enum:
        - draft
        - pending
        - paid
        - failed
        - refunded
        - cancelled
      title: InvoiceStatus
      description: Invoice status enumeration.
    InvoiceItem:
      properties:
        description:
          type: string
          title: Description
        quantity:
          type: integer
          title: Quantity
        unit_price:
          type: number
          title: Unit Price
        total:
          type: number
          title: Total
        server_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Server Id
      type: object
      required:
        - description
        - quantity
        - unit_price
        - total
        - server_id
      title: InvoiceItem
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      required:
        - code
        - message
      title: ErrorDetail
  securitySchemes:
    bearerAuth:
      type: http
      description: API token from Dashboard > Settings > API Tokens.
      scheme: bearer
      bearerFormat: arct_...

````

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