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

# Agreements

> Display required user agreements after KYC approval.

<Tip>
  Prerequisite: KYC status is <code>approved</code>

  .
</Tip>

## Flow

```mermaid theme={null}
sequenceDiagram
  participant Backend as Your Backend
  participant MachinesAPI as Machines API
  participant User as User

  Backend->>MachinesAPI: GET /agreements
  MachinesAPI-->>Backend: agreements + accepted status
  Backend->>User: show agreements + links
  User-->>Backend: accepts all
  Backend->>MachinesAPI: POST /agreements { accepted: true }
  MachinesAPI-->>Backend: acceptedAt
```

## API flows (step-by-step)

<Steps>
  <Step title="1) Fetch agreements">
    <b>Endpoint</b>

    : <a href="/api/agreements/list" target="_blank" rel="noreferrer"><code>GET /agreements</code></a>

    \
    <b>Response</b>

    : <code>agreements\[]</code>

    (text + links), <code>accepted</code>

    , <code>acceptedAt</code>

    .

    ```bash theme={null}
    curl -s \
      -H 'Authorization: Bearer <SESSION_TOKEN>' \
      https://dev-api.machines.cash/partner/v1/agreements
    ```
  </Step>

  <Step title="2) Show agreements to the user">
    Render each agreement’s <code>text</code>

    , and open the <code>links\[].url</code>

    in a new tab. The user must accept all agreements.
  </Step>

  <Step title="3) Submit acceptance">
    <b>Endpoint</b>

    : <a href="/api/agreements/accept" target="_blank" rel="noreferrer"><code>POST /agreements</code></a>

    \
    <b>Body</b>

    : <code>{"{ \"accepted\": true }"}</code>

    ```bash theme={null}
    curl -s \
      -H 'Authorization: Bearer <SESSION_TOKEN>' \
      -H 'Content-Type: application/json' \
      -d '{"accepted": true}' \
      https://dev-api.machines.cash/partner/v1/agreements
    ```
  </Step>
</Steps>

<Note>
  If KYC is not approved, these endpoints return <code>409</code>

  with <code>invalid\_state</code>

  .
</Note>

## What this unlocks

After acceptance, the user can create cards, create deposits, and read balances. Those endpoints return <code>409</code>

until agreements are accepted.
