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

# Utwórz narzędzie

> Tworzy nowe narzędzie (np. wywołanie HTTP API dostępne dla agentów).



## OpenAPI

````yaml /api-reference/openapi.pl.json post /api/v1/tools
openapi: 3.1.0
info:
  title: Brosbots API
  description: >
    Publiczne REST API Brosbots. Buduj i zarządzaj agentami głosowymi,

    uruchamiaj kampanie wychodzące, odczytuj rozmowy i zużycie oraz zarządzaj

    numerami telefonów, narzędziami, bazami wiedzy i integracjami.


    ## Uwierzytelnianie


    Każde żądanie musi zawierać klucz API organizacji w nagłówku `X-API-Key`:


    ```

    X-API-Key: bb_live_...

    ```


    Klucze tworzysz i unieważniasz w panelu: kliknij swoje konto w lewym dolnym
    rogu paska bocznego, a potem **Brosbots API**.


    ## Adres bazowy


    ```

    https://app.brosbots.com/api/v1

    ```


    ## Konwencje


    - Ciała żądań i odpowiedzi są w JSON (`Content-Type: application/json`).

    - Znaczniki czasu w ISO 8601 ze strefą czasową.

    - Listy stronicowane parametrami `page` / `limit`; odpowiedź zawiera
      `total_count` / `total_pages`.
    - Błędy używają standardowych kodów HTTP z ciałem JSON:
      `{"detail": "czytelny powód błędu"}`.
    - `{agent_id}` przyjmuje publiczne ID agenta (`agent_...`) albo jego numer.


    ## Limity


    API nie ma dziś stałego limitu liczby zapytań na klucz. Kod `429` zwracają

    endpointy dzwoniące (`POST /agents/{agent_id}/calls` i

    `POST /triggers/{trigger_id}/calls`), gdy wszystkie kanały wychodzące są
    zajęte; nagłówek `Retry-After` podaje, ile sekund odczekać.

    Obsługuj `429` ogólnie: czekaj tyle, ile mówi `Retry-After`, a gdy go nie ma
    -

    ponawiaj z wykładniczym odstępem. Limit zapytań może zostać wprowadzony.
  version: 1.0.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/v1/tools:
    post:
      tags:
        - Narzędzia
      summary: Utwórz narzędzie
      description: Tworzy nowe narzędzie (np. wywołanie HTTP API dostępne dla agentów).
      operationId: post_tools
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateToolRequest'
      responses:
        '200':
          description: Pomyślna odpowiedź
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ToolResponse'
        '404':
          description: Nie znaleziono
        '422':
          description: Błąd walidacji
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateToolRequest:
      properties:
        name:
          type: string
          maxLength: 255
        description:
          anyOf:
            - type: string
            - type: 'null'
        category:
          type: string
          default: http_api
        icon:
          anyOf:
            - type: string
              maxLength: 50
            - type: 'null'
          default: globe
        icon_color:
          anyOf:
            - type: string
              maxLength: 7
            - type: 'null'
          default: '#3B82F6'
        definition:
          oneOf:
            - $ref: '#/components/schemas/HttpApiToolDefinition'
            - $ref: '#/components/schemas/EndCallToolDefinition'
            - $ref: '#/components/schemas/TransferToolDefinition'
            - $ref: '#/components/schemas/IntegrationToolDefinition'
          discriminator:
            propertyName: type
            mapping:
              end_call: '#/components/schemas/EndCallToolDefinition'
              http_api: '#/components/schemas/HttpApiToolDefinition'
              integration: '#/components/schemas/IntegrationToolDefinition'
              transfer: '#/components/schemas/TransferToolDefinition'
      type: object
      required:
        - name
        - definition
      title: CreateToolRequest
      description: Utworzenie narzędzia.
    ToolResponse:
      properties:
        id:
          type: integer
        tool_uuid:
          type: string
        name:
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
        category:
          type: string
        icon:
          anyOf:
            - type: string
            - type: 'null'
        icon_color:
          anyOf:
            - type: string
            - type: 'null'
        status:
          type: string
        definition:
          additionalProperties: true
          type: object
        created_at:
          type: string
          format: date-time
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
        created_by:
          anyOf:
            - $ref: '#/components/schemas/CreatedByResponse'
            - type: 'null'
      type: object
      required:
        - id
        - tool_uuid
        - name
        - description
        - category
        - icon
        - icon_color
        - status
        - definition
        - created_at
        - updated_at
      title: ToolResponse
      description: Narzędzie.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
      title: HTTPValidationError
    HttpApiToolDefinition:
      properties:
        schema_version:
          type: integer
          description: Wersja schematu.
          default: 1
        type:
          type: string
          const: http_api
          description: Typ narzędzia.
        config:
          $ref: '#/components/schemas/HttpApiConfig'
          description: Konfiguracja HTTP API.
      type: object
      required:
        - type
        - config
      title: HttpApiToolDefinition
      description: Definicja narzędzia HTTP API.
    EndCallToolDefinition:
      properties:
        schema_version:
          type: integer
          description: Wersja schematu.
          default: 1
        type:
          type: string
          const: end_call
          description: Typ narzędzia.
        config:
          $ref: '#/components/schemas/EndCallConfig'
          description: Konfiguracja zakończenia rozmowy.
      type: object
      required:
        - type
        - config
      title: EndCallToolDefinition
      description: Definicja narzędzia Zakończ rozmowę.
    TransferToolDefinition:
      properties:
        schema_version:
          type: integer
          description: Wersja schematu.
          default: 1
        type:
          type: string
          const: transfer
          description: Typ narzędzia.
        config:
          $ref: '#/components/schemas/TransferConfig'
          description: Konfiguracja przekazania.
      type: object
      required:
        - type
        - config
      title: TransferToolDefinition
      description: Definicja narzędzia Przekaż rozmowę.
    IntegrationToolDefinition:
      properties:
        schema_version:
          type: integer
          description: Wersja schematu.
          default: 1
        type:
          type: string
          const: integration
          description: Typ narzędzia.
        config:
          $ref: '#/components/schemas/IntegrationConfig'
          description: Konfiguracja integracji.
      type: object
      required:
        - type
        - config
      title: IntegrationToolDefinition
      description: Definicja gotowego narzędzia integracji.
    CreatedByResponse:
      properties:
        id:
          type: integer
        provider_id:
          type: string
      type: object
      required:
        - id
        - provider_id
      title: CreatedByResponse
      description: Użytkownik, który utworzył narzędzie.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HttpApiConfig:
      properties:
        method:
          type: string
          description: Metoda HTTP (GET, POST, PUT, PATCH, DELETE).
        url:
          type: string
          description: Docelowy URL.
        headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          description: Stałe nagłówki dołączane do żądania.
        credential_uuid:
          anyOf:
            - type: string
            - type: 'null'
          description: ID zapisanych danych uwierzytelniających używanych do autoryzacji.
        parameters:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolParameter'
              type: array
            - type: 'null'
          description: Parametry, które narzędzie przyjmuje od modelu językowego.
        timeout_ms:
          anyOf:
            - type: integer
            - type: 'null'
          description: Limit czasu żądania w milisekundach.
          default: 5000
        trigger_phrases:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Co mówią rozmówcy, gdy należy użyć tego narzędzia.
        wait_message:
          anyOf:
            - type: string
            - type: 'null'
          description: Wypowiadane do rozmówcy w trakcie wykonywania żądania.
        response_fields:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Ścieżki (z kropkami) do pól odpowiedzi przekazywanych modelowi.
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          description: Co agent mówi rozmówcy, gdy żądanie się nie powiedzie.
        template_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Szablon kreatora, z którego utworzono narzędzie.
      type: object
      required:
        - method
        - url
      title: HttpApiConfig
      description: Konfiguracja narzędzia HTTP API.
    EndCallConfig:
      properties:
        messageType:
          type: string
          enum:
            - none
            - custom
          description: Rodzaj wiadomości pożegnalnej.
          default: none
        customMessage:
          anyOf:
            - type: string
            - type: 'null'
          description: Własna wiadomość odtwarzana przed zakończeniem rozmowy.
      type: object
      title: EndCallConfig
      description: Konfiguracja narzędzia Zakończ rozmowę.
    TransferConfig:
      properties:
        destination_number:
          anyOf:
            - type: string
            - type: 'null'
          description: Domyślny numer, na który przekazać rozmowę (E.164).
        message:
          anyOf:
            - type: string
            - type: 'null'
          description: Wiadomość wypowiadana przed przekazaniem.
        parameters:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolParameter'
              type: array
            - type: 'null'
          description: >-
            Parametry, które model językowy może przekazać. Podany przez niego
            destination_number jest użyty tylko wtedy, gdy jest jednym z numerów
            skonfigurowanych w agencie.
      type: object
      title: TransferConfig
      description: Konfiguracja narzędzia Przekaż rozmowę.
    IntegrationConfig:
      properties:
        provider:
          type: string
          description: Dostawca integracji, np. 'weather' lub 'crm_lookup'.
        action:
          anyOf:
            - type: string
            - type: 'null'
          description: Akcja dostawcy.
        parameters:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolParameter'
              type: array
            - type: 'null'
          description: Parametry, które model językowy może przekazać integracji.
        crm_type:
          anyOf:
            - type: string
            - type: 'null'
          description: CRM, do którego trafia zapytanie, np. 'hubspot'.
        api_key:
          anyOf:
            - type: string
            - type: 'null'
          description: Klucz API do CRM.
      type: object
      required:
        - provider
      title: IntegrationConfig
      description: >-
        Konfiguracja gotowych narzędzi integracji (pogoda, wyszukiwanie w
        CRM...).
    ToolParameter:
      properties:
        name:
          type: string
          description: Nazwa parametru (klucz w ciele żądania).
        type:
          type: string
          description: 'Typ parametru: string, number lub boolean.'
        description:
          type: string
          description: Opis, do czego służy parametr.
        required:
          type: boolean
          description: Czy parametr jest wymagany.
          default: true
      type: object
      required:
        - name
        - type
        - description
      title: ToolParameter
      description: Parametr przyjmowany przez narzędzie.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Klucz API organizacji (konto w lewym dolnym rogu panelu → Brosbots API).

````

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