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

# Ustaw limit wydatków API

> Ustawia limit wydatków na nadwyżkę ponad jednostki w cenie planu (w złotych, na okres rozliczeniowy). Po jego osiągnięciu API odpowiada 402 do końca okresu; `null` przywraca domyślny pułap 1 000 zł. Zwraca zaktualizowany licznik.



## OpenAPI

````yaml /openapi.json put /v1/usage/api/spend-cap
openapi: 3.1.0
info:
  title: krdata API
  description: >

    krdata udostępnia dane z polskich rejestrów gospodarczych (KRS, CRBR, KRZ,
    MSiG, BZP, RDF, KNF, UOKiK, SUDOP,

    biała lista VAT) w postaci jednego, spójnego API.


    Uwierzytelnianie odbywa się przez klucz API w nagłówku `x-api-key`. Płatne
    endpointy zużywają jednostki

    z jednej puli; koszt każdego z nich podany jest w jego opisie, a zasady w
    sekcji Rozliczanie.

    Bieżący stan puli zwraca `GET /v1/usage/api`.
  version: 0.1.0
servers:
  - url: https://api.krdata.pl
    description: Production
security: []
paths:
  /v1/usage/api/spend-cap:
    put:
      tags:
        - Usage
      summary: Ustaw limit wydatków API
      description: >-
        Ustawia limit wydatków na nadwyżkę ponad jednostki w cenie planu (w
        złotych, na okres rozliczeniowy). Po jego osiągnięciu API odpowiada 402
        do końca okresu; `null` przywraca domyślny pułap 1 000 zł. Zwraca
        zaktualizowany licznik.
      operationId: usage-api-spend-cap
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpendCapPayload'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiMeter'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    SpendCapPayload:
      properties:
        spend_cap_pln:
          anyOf:
            - type: integer
              maximum: 1000
              minimum: 0
            - type: 'null'
          title: Spend Cap Pln
      type: object
      title: SpendCapPayload
    ApiMeter:
      properties:
        period_start:
          type: string
          format: date-time
          title: Period Start
        period_end:
          type: string
          format: date-time
          title: Period End
        included:
          anyOf:
            - type: integer
            - type: 'null'
          title: Included
        used:
          type: integer
          title: Used
        overage_units:
          type: integer
          title: Overage Units
        overage_grosz:
          type: integer
          title: Overage Grosz
        unit_grosz:
          type: integer
          title: Unit Grosz
        document_units:
          type: integer
          title: Document Units
        trial:
          type: boolean
          title: Trial
        trial_requests:
          type: integer
          title: Trial Requests
        spend_cap_pln:
          anyOf:
            - type: integer
            - type: 'null'
          title: Spend Cap Pln
        max_overage_pln:
          type: integer
          title: Max Overage Pln
        allowance:
          anyOf:
            - type: integer
            - type: 'null'
          title: Allowance
      type: object
      required:
        - period_start
        - period_end
        - included
        - used
        - overage_units
        - overage_grosz
        - unit_grosz
        - document_units
        - trial
        - trial_requests
        - spend_cap_pln
        - max_overage_pln
        - allowance
      title: ApiMeter
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````