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

# Manage Terms & Conditions acceptance in the SDK

> Check, display, and record end-user acceptance of Squire Terms and Conditions before enabling consultation recording in your EHR integration.

End users must accept Squire's Terms & Conditions before you can start recording a consultation. The SDK provides a dedicated method to check the acceptance status, retrieve the document URL, and programmatically record acceptance — so you can build this flow directly into your EHR's login or onboarding screen.

## Acceptance flow

<Steps>
  <Step title="Retrieve T&C document info">
    After [initializing the SDK](/integration/sdk/usage#initialize-the-sdk), fetch the current Terms & Conditions document for the authenticated user:

    ```javascript theme={null}
    const terms = await squire.getTermsAndConditionsDocumentInfo();
    ```
  </Step>

  <Step title="Check acceptance status">
    Check whether the user has already accepted the current version:

    ```javascript theme={null}
    if (terms.isAccepted) {
      // The user has accepted. Proceed to start consultations.
      return;
    }

    // Otherwise, display the document and prompt the user to accept.
    ```
  </Step>

  <Step title="Display the document">
    Use `terms.documentUrl` to show the document to the user. You can open it in a new tab:

    ```html theme={null}
    <a id="terms-link" target="_blank">View Terms &amp; Conditions</a>
    ```

    ```javascript theme={null}
    document.getElementById('terms-link').href = terms.documentUrl;
    ```

    Alternatively, embed the document in an iframe for an in-app experience:

    ```html theme={null}
    <iframe id="terms-frame" style="width:100%;height:500px;"></iframe>
    ```

    ```javascript theme={null}
    document.getElementById('terms-frame').src = terms.documentUrl;
    ```
  </Step>

  <Step title="Record acceptance">
    When the user clicks your accept button, call `terms.accept()`:

    ```javascript theme={null}
    const acceptButton = document.getElementById('accept-terms');

    acceptButton.addEventListener('click', async () => {
      await terms.accept();
      console.log('Terms accepted successfully.');
      // Proceed to enable consultation recording.
    });
    ```
  </Step>
</Steps>

## Handling T\&C version updates

When Squire publishes a new version of the Terms & Conditions, `getTermsAndConditionsDocumentInfo()` automatically returns the new version with an updated `documentUrl` and `isAccepted` set to `false`. Users who accepted a previous version must accept the new one before they can record again. Run the same acceptance flow described above whenever `isAccepted` is `false`.

## API reference

### `getTermsAndConditionsDocumentInfo()`

Returns a promise that resolves with information about the current Terms & Conditions document.

| Property           | Type                  | Description                                                     |
| ------------------ | --------------------- | --------------------------------------------------------------- |
| `uuid`             | `string`              | Unique identifier of the T\&C document version                  |
| `documentFilename` | `string`              | Filename of the T\&C document                                   |
| `documentUrl`      | `string`              | URL where the T\&C document can be downloaded or displayed      |
| `createdDt`        | `Date`                | Date the document version was created                           |
| `acceptedDt`       | `Date \| null`        | Date the user accepted the terms, or `null` if not yet accepted |
| `isAccepted`       | `boolean`             | Whether the current user has accepted this version              |
| `accept()`         | `() => Promise<void>` | Records the user's acceptance of the current document           |
