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

# Upload contract

> Upload a carrier contract document. Opereit asynchronously extracts rate cards and surcharges from the file. The contract is created with `status=PROCESSING`; it transitions to `ACTIVE` once extraction completes (or `FAILED` if extraction errors out).

Accepted file formats: PDF, PNG, JPEG, CSV, XLS, XLSX.



## OpenAPI

````yaml POST /v1/contracts
openapi: 3.1.0
info:
  title: Opereit Invoice Auditing API
  description: >-
    Public API for the Opereit Invoice Auditing product. Upload carrier
    contracts, run audits against incoming carrier invoices, and retrieve line
    items and findings.
  version: 1.0.0
servers:
  - url: https://api.opereit.com
    description: Production
security:
  - apiKey: []
paths:
  /v1/contracts:
    post:
      summary: Upload a carrier contract
      description: >-
        Upload a carrier contract document. Opereit asynchronously extracts rate
        cards and surcharges from the file. The contract is created with
        `status=PROCESSING`; it transitions to `ACTIVE` once extraction
        completes (or `FAILED` if extraction errors out).


        Accepted file formats: PDF, PNG, JPEG, CSV, XLS, XLSX.
      operationId: uploadContract
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - carrier_name
                - signing_date
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    The contract document. Accepted MIME types:
                    `application/pdf`, `image/png`, `image/jpeg`, `text/csv`,
                    `application/vnd.ms-excel`,
                    `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`.
                carrier_name:
                  type: string
                  description: >-
                    The carrier this contract belongs to (e.g. `UPS`, `FedEx`,
                    `DHL Express`).
                signing_date:
                  type: string
                  format: date
                  description: Date the contract was signed, in `YYYY-MM-DD` format.
                contract_number:
                  type: string
                  description: Optional carrier-issued contract number.
                account_number:
                  type: string
                  description: Optional carrier account number this contract applies to.
      responses:
        '201':
          description: Contract created. Extraction runs asynchronously.
          content:
            application/json:
              schema:
                type: object
                properties:
                  contract:
                    $ref: '#/components/schemas/Contract'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    Contract:
      type: object
      description: >-
        A carrier contract uploaded to Opereit. Rates and surcharges are
        extracted asynchronously.
      required:
        - id
        - carrier_name
        - signing_date
        - status
        - rate_count
        - surcharge_count
        - created_at
      properties:
        id:
          type: string
          description: Unique identifier for the contract.
        carrier_name:
          type: string
          description: Carrier the contract belongs to.
          example: DHL Express
        contract_number:
          type:
            - string
            - 'null'
          description: Carrier-issued contract number, if any.
        account_number:
          type:
            - string
            - 'null'
          description: Carrier account number this contract applies to, if any.
        signing_date:
          type: string
          format: date
          description: Date the contract was signed.
        effective_date:
          type:
            - string
            - 'null'
          format: date
          description: Date the contracted rates take effect, if specified.
        expiration_date:
          type:
            - string
            - 'null'
          format: date
          description: Date the contract expires, if specified.
        status:
          type: string
          enum:
            - PROCESSING
            - ACTIVE
            - EXPIRED
            - FAILED
          description: |-
            Contract lifecycle state.

            - `PROCESSING`: extraction in progress.
            - `ACTIVE`: extraction complete; rates and surcharges are available.
            - `EXPIRED`: contract expiration date has passed.
            - `FAILED`: extraction failed; see `status_reason`.
        status_reason:
          type:
            - string
            - 'null'
          description: Explanation when `status=FAILED`.
        file_url:
          type: string
          format: uri
          description: Time-limited URL to download the original contract file.
        rate_count:
          type: integer
          description: Number of rate-card entries extracted from the contract.
        surcharge_count:
          type: integer
          description: Number of surcharges extracted from the contract.
        created_at:
          type: string
          format: date-time
          description: When the contract was uploaded.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
  responses:
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: basic
      description: >-
        HTTP Basic Auth using your API key. Send `Authorization: Basic
        base64(key_id:key_secret)`.

````