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

# Criar vínculo

> Liga uma pessoa a uma conta ou parceiro, com papel e validade.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/identity/links
openapi: 3.1.0
info:
  title: API de dados da Niadra
  version: '1'
  description: >-
    Escrita, contexto, histórico, objetos, identidade, privacidade e governança
    de um espaço. Cada espaço tem um endereço estável, com o espaço e a região
    no nome.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: O espaço, que vem na chave de fonte.
      region:
        default: us-east-1
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/identity/links:
    post:
      tags:
        - identity
      summary: Criar vínculo
      description: >-
        Liga uma pessoa a uma conta ou parceiro, com papel e validade. Pessoa e
        organização nunca se fundem: o que as liga é um vínculo.


        **Autenticação.** Token de pessoa do Console com o papel `security`,
        `integration` (ou admin), ou chave de fonte com o escopo `admin`.
      operationId: create_link_v1_identity_links_post
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            title: Idempotency-Key
            type: string
          description: >-
            Obrigatório. Fica guardado 24 horas com o hash do corpo: repetir com
            a mesma chave devolve a primeira resposta, e a mesma chave com outro
            corpo devolve 409 `conflict`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LinkIn'
            example:
              person:
                type: phone_e164
                value: '+14155550123'
              organization:
                type: system_id
                value: ACC-2201
                scope: crm
                subject_kind: account
              role: buyer
              method: system_import
              can_see_contacts: false
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkOut'
              example:
                link_id: 0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e08
                person_handle_id: 0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e02
                org_handle_id: 0192f7a1-5b10-7c3a-8e21-4d2f8a4c0e05
                role: buyer
                can_see_contacts: false
                valid_from: '2026-09-22T17:10:00Z'
                valid_to: null
          description: O vínculo.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            422 `invalid_input`, `verification_not_allowed` ou
            `about_without_link`.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    LinkIn:
      additionalProperties: false
      properties:
        can_see_contacts:
          default: false
          title: Can See Contacts
          type: boolean
        method:
          default: declared
          enum:
            - system_import
            - co_occurrence
            - declared
            - login
          title: Method
          type: string
        organization:
          $ref: '#/components/schemas/Handle'
        person:
          $ref: '#/components/schemas/Handle'
        role:
          description: '`buyer`, `driver`, `broker`, `technical_contact`, `owner` e outros.'
          maxLength: 256
          minLength: 1
          title: Role
          type: string
        valid_from:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Valid From
        valid_to:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Valid To
      required:
        - person
        - organization
        - role
      title: LinkIn
      type: object
    LinkOut:
      additionalProperties: false
      properties:
        can_see_contacts:
          title: Can See Contacts
          type: boolean
        link_id:
          format: uuid
          title: Link Id
          type: string
        org_handle_id:
          format: uuid
          title: Org Handle Id
          type: string
        person_handle_id:
          format: uuid
          title: Person Handle Id
          type: string
        role:
          title: Role
          type: string
        valid_from:
          format: date-time
          title: Valid From
          type: string
        valid_to:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Valid To
      required:
        - link_id
        - person_handle_id
        - org_handle_id
        - role
        - can_see_contacts
        - valid_from
      title: LinkOut
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    Handle:
      additionalProperties: false
      description: >-
        Um identificador de um sujeito num canal ou sistema: um telefone, um
        e-mail, um id do CRM.
      properties:
        scope:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          description: >-
            Espaço de nomes dos identificadores com escopo: a conta do WhatsApp
            Business para `wa_bsuid`, o sistema para `system_id`, o país para
            `gov_id_hmac`.
          title: Scope
        subject_kind:
          anyOf:
            - $ref: '#/components/schemas/SubjectKind'
            - type: 'null'
          description: >-
            O padrão é `person`, exceto nos tipos de handle que só identificam
            organizações.
        type:
          $ref: '#/components/schemas/HandleType'
        value:
          maxLength: 320
          minLength: 1
          title: Value
          type: string
          description: >-
            O identificador. Normalizado no servidor: E.164 para telefone,
            minúsculas para e-mail.
      required:
        - type
        - value
      title: Handle
      type: object
    SubjectKind:
      enum:
        - person
        - account
        - partner
      title: SubjectKind
      type: string
      description: >-
        Uma pessoa, uma organização cliente (`account`) ou uma organização que
        participa sem ser cliente (`partner`).
    HandleType:
      enum:
        - phone_e164
        - wa_id
        - wa_jid
        - wa_lid
        - wa_bsuid
        - email
        - gov_id_hmac
        - app_user_id
        - system_id
        - org_registry_hmac
        - email_domain
        - anon_id
      title: HandleType
      type: string
      description: >-
        O tipo de identificador. O valor é classificado pelo formato, nunca pelo
        campo de onde veio.
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````