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

# Aceitar uma transferência

> Quem recebe aceita; uma transferência fechada ou vencida responde 409.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/handoffs/{handoff_id}/accept
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-2
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/handoffs/{handoff_id}/accept:
    post:
      tags:
        - coordination
      summary: Aceitar uma transferência
      description: >-
        Quem recebe aceita a transferência.


        **Autenticação.** Chave de fonte: `Authorization: Bearer nia_sk_...`.
        Escopo exigido: `coordinate`. Só responde num espaço com a
        funcionalidade `coordination` ligada (o documento `features`); num
        espaço sem ela, 404.
      operationId: accept_handoff_v1_handoffs__handoff_id__accept_post
      parameters:
        - in: path
          name: handoff_id
          required: true
          schema:
            title: Handoff Id
            type: string
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            title: Idempotency-Key
            type: string
          description: >-
            Obrigatório. Guardado por 24 horas com o hash do corpo: a mesma
            chave com o mesmo corpo devolve a primeira resposta, e a mesma chave
            com outro corpo devolve 409 `conflict`.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Handoff'
          description: A transferência, aceita.
        '409':
          description: A transferência foi fechada ou venceu.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - sourceKey: []
components:
  schemas:
    Handoff:
      additionalProperties: false
      properties:
        created_at:
          format: date-time
          title: Created At
          type: string
        expected_by:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Expected By
        handoff_id:
          maxLength: 512
          minLength: 1
          title: Handoff Id
          type: string
        outcome:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Outcome
        package:
          anyOf:
            - $ref: '#/components/schemas/HandoffPackage'
            - type: 'null'
        status:
          enum:
            - created
            - accepted
            - closed
            - expired
          title: Status
          type: string
      required:
        - handoff_id
        - status
        - created_at
      title: Handoff
      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
    HandoffPackage:
      additionalProperties: false
      description: >-
        O que uma transferência leva a quem a recebe (a especificação de
        coordenação, 7).
      properties:
        commitments_active:
          items:
            $ref: '#/components/schemas/CommitmentRef'
          title: Commitments Active
          type: array
        context:
          $ref: '#/components/schemas/HandoffContext'
        created_at:
          format: date-time
          title: Created At
          type: string
        effects:
          items:
            $ref: '#/components/schemas/EffectSeen'
          title: Effects
          type: array
        from_agent:
          maxLength: 256
          minLength: 1
          title: From Agent
          type: string
        handoff_id:
          maxLength: 512
          minLength: 1
          title: Handoff Id
          type: string
        level:
          $ref: '#/components/schemas/Verification'
        open_objects:
          items:
            $ref: '#/components/schemas/OpenObject'
          maxItems: 50
          title: Open Objects
          type: array
        outcome:
          $ref: '#/components/schemas/OutcomeRequest'
        owner:
          anyOf:
            - $ref: '#/components/schemas/Owner'
            - type: 'null'
        promises_open:
          items:
            $ref: '#/components/schemas/PromiseRef'
          title: Promises Open
          type: array
        reason:
          anyOf:
            - maxLength: 500
              minLength: 1
              type: string
            - type: 'null'
          title: Reason
        spec:
          const: handoff-package.v0
          default: handoff-package.v0
          title: Spec
          type: string
        subject:
          anyOf:
            - $ref: '#/components/schemas/Handle'
            - type: 'null'
          description: De quem a transferência trata.
        suppressions:
          items:
            pattern: ^[a-z][a-z0-9_]{0,39}$
            type: string
          title: Suppressions
          type: array
        target:
          maxLength: 256
          minLength: 1
          title: Target
          type: string
      required:
        - handoff_id
        - created_at
        - from_agent
        - target
        - level
        - context
      title: HandoffPackage
      type: object
    CommitmentRef:
      additionalProperties: false
      properties:
        id:
          maxLength: 512
          minLength: 1
          title: Id
          type: string
        type:
          pattern: ^[a-z][a-z0-9_]{0,39}$
          title: Type
          type: string
        valid_until:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Valid Until
      required:
        - id
        - type
      title: CommitmentRef
      type: object
    HandoffContext:
      additionalProperties: false
      description: >-
        A view `handoff` compilada, na política e no nível de verificação de
        quem recebe. `etag` é o do contexto de que foi compilada, ausente para
        um cliente de quem a memória ainda não sabe nada.
      properties:
        etag:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Etag
        policy_version:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Policy Version
        text:
          title: Text
          type: string
      required:
        - text
      title: HandoffContext
      type: object
    EffectSeen:
      additionalProperties: false
      properties:
        effect_id:
          pattern: ^[A-Za-z0-9_-]{43}$
          title: Effect Id
          type: string
        kind:
          $ref: '#/components/schemas/EffectKind'
        state:
          enum:
            - reserved
            - done
            - failed
            - unknown_outcome
          title: State
          type: string
      required:
        - effect_id
        - kind
        - state
      title: EffectSeen
      type: object
    Verification:
      description: >-
        Nível de verificação da sessão. V0 autodeclarado, V1 plausível pelo
        canal, V2 atestado pelo canal, V3 desafiado (OTP ou login), V4 conferido
        com um sistema de registro ou por um atendente. `no_customer` vale para
        tarefas sem cliente presente e só é aceito de fontes de agente interno.
      enum:
        - V0
        - V1
        - V2
        - V3
        - V4
        - no_customer
      title: Verification
      type: string
    OpenObject:
      additionalProperties: false
      properties:
        ref:
          $ref: '#/components/schemas/ObjectRef'
        since:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Since
        state:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: State
      required:
        - ref
      title: OpenObject
      type: object
    OutcomeRequest:
      additionalProperties: false
      description: >-
        Como quem recebe reporta de volta: um de `vocabulary`, até
        `expected_by`.
      properties:
        expected_by:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Expected By
        vocabulary:
          items:
            pattern: ^[a-z][a-z0-9_]{0,39}$
            type: string
          maxItems: 50
          title: Vocabulary
          type: array
      title: OutcomeRequest
      type: object
    Owner:
      additionalProperties: false
      description: >-
        Quem detém o cliente ou o objeto agora: a reivindicação válida mais
        restritiva, de onde veio e até quando. `epoch` protege uma liberação.
      properties:
        epoch:
          title: Epoch
          type: integer
        holder:
          maxLength: 256
          minLength: 1
          title: Holder
          type: string
        kind:
          $ref: '#/components/schemas/ClaimKind'
        level:
          pattern: ^[a-z][a-z0-9_]{0,39}$
          title: Level
          type: string
        since:
          format: date-time
          title: Since
          type: string
        source:
          maxLength: 256
          minLength: 1
          title: Source
          type: string
        valid_until:
          format: date-time
          title: Valid Until
          type: string
        via:
          $ref: '#/components/schemas/ClaimVia'
      required:
        - holder
        - kind
        - level
        - source
        - via
        - since
        - valid_until
        - epoch
      title: Owner
      type: object
    PromiseRef:
      additionalProperties: false
      properties:
        due:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Due
        id:
          maxLength: 512
          minLength: 1
          title: Id
          type: string
        owner:
          maxLength: 256
          minLength: 1
          title: Owner
          type: string
      required:
        - id
        - owner
      title: PromiseRef
      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
    EffectKind:
      enum:
        - delivery
        - document
        - notice
        - filing
        - paid_call
        - external_action
      title: EffectKind
      type: string
    ObjectRef:
      additionalProperties: false
      description: Um objeto de negócio num sistema de registro.
      properties:
        id:
          maxLength: 512
          minLength: 1
          title: Id
          type: string
          description: O id nesse sistema.
        namespace:
          maxLength: 256
          minLength: 1
          title: Namespace
          type: string
          description: O sistema onde ele vive, como `erp`.
        type:
          maxLength: 256
          minLength: 1
          title: Type
          type: string
          description: Tipo do objeto, como `invoice`, `order` ou `ticket`.
      required:
        - type
        - namespace
        - id
      title: ObjectRef
      type: object
    ClaimKind:
      enum:
        - owner
        - case
        - task_lock
      title: ClaimKind
      type: string
    ClaimVia:
      description: >-
        Os três caminhos de entrada: uma declaração pela API, uma observação
        mapeada de um webhook, uma observação que o worker da empresa leu e
        enviou.
      enum:
        - declaration
        - mapping
        - worker
      title: ClaimVia
      type: string
    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_...

````