> ## 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.

# Graf powiązań

> Buduje graf powiązań do określonej głębokości (1–3) wokół wskazanej spółki lub osoby. Identyfikator może być KRS, NIP, PESEL, UUID albo prefiksowanym ID grafu (`krs:0000123456` / `person:<uuid>`). Wynik jest ograniczony do 200 węzłów; węzły huba (powyżej 100 krawędzi) nie są dalej rozwijane. Każde wywołanie = 1 jednostka puli **Rejestr firm i osób**.



## OpenAPI

````yaml /openapi.json get /v1/graph/{identifier}
openapi: 3.1.0
info:
  title: krdata API
  description: >

    krdata udostępnia dane z polskich rejestrów gospodarczych (KRS, CRBR, KRZ,
    MSiG, biała lista VAT)

    w postaci jednego, spójnego API.


    Uwierzytelnianie odbywa się przez klucz API przekazywany w nagłówku
    `x-api-key`.

    Limity zapytań oraz dzienne pule (PDF, WPV, raporty) wynikają z wybranego
    abonamentu —

    szczegóły zwraca endpoint `GET /v1/usage/summary`.
  version: 0.1.0
servers:
  - url: https://api.krdata.pl
    description: Production
security: []
paths:
  /v1/graph/{identifier}:
    get:
      tags:
        - Graph
      summary: Graf powiązań
      description: >-
        Buduje graf powiązań do określonej głębokości (1–3) wokół wskazanej
        spółki lub osoby. Identyfikator może być KRS, NIP, PESEL, UUID albo
        prefiksowanym ID grafu (`krs:0000123456` / `person:<uuid>`). Wynik jest
        ograniczony do 200 węzłów; węzły huba (powyżej 100 krawędzi) nie są
        dalej rozwijane. Każde wywołanie = 1 jednostka puli **Rejestr firm i
        osób**.
      operationId: graph
      parameters:
        - name: identifier
          in: path
          required: true
          schema:
            type: string
            title: Identifier
        - name: depth
          in: query
          required: false
          schema:
            type: integer
            maximum: 3
            minimum: 1
            default: 2
            title: Depth
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GraphResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    GraphResponse:
      properties:
        root_id:
          type: string
          title: Root Id
        depth:
          type: integer
          title: Depth
        truncated:
          type: boolean
          title: Truncated
        max_nodes:
          type: integer
          title: Max Nodes
        nodes:
          items:
            $ref: '#/components/schemas/GraphNode'
          type: array
          title: Nodes
        edges:
          items:
            $ref: '#/components/schemas/GraphEdge'
          type: array
          title: Edges
      type: object
      required:
        - root_id
        - depth
        - truncated
        - max_nodes
        - nodes
        - edges
      title: GraphResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GraphNode:
      properties:
        id:
          type: string
          title: Id
        kind:
          type: string
          title: Kind
        name:
          type: string
          title: Name
        identifiers:
          anyOf:
            - $ref: '#/components/schemas/Identifiers'
            - type: 'null'
        datasets:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Datasets
        is_root:
          type: boolean
          title: Is Root
          default: false
        is_hub:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Hub
        edge_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Edge Count
      type: object
      required:
        - id
        - kind
        - name
      title: GraphNode
    GraphEdge:
      properties:
        source:
          type: string
          title: Source
        target:
          type: string
          title: Target
        roles:
          items:
            $ref: '#/components/schemas/GraphEdgeRole'
          type: array
          title: Roles
      type: object
      required:
        - source
        - target
        - roles
      title: GraphEdge
    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
    Identifiers:
      properties:
        krs:
          anyOf:
            - type: string
            - type: 'null'
          title: Krs
        nip:
          anyOf:
            - type: string
            - type: 'null'
          title: Nip
        regon:
          anyOf:
            - type: string
            - type: 'null'
          title: Regon
        registry_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Registry Type
      type: object
      title: Identifiers
    GraphEdgeRole:
      properties:
        source:
          type: string
          title: Source
        relation:
          type: string
          title: Relation
        role_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Role Type
        position:
          anyOf:
            - type: string
            - type: 'null'
          title: Position
      type: object
      required:
        - source
        - relation
      title: GraphEdgeRole
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````