# Terms and Conditions Administration

The Terms and Conditions (T&Cs) are presented to end users as follows:

- **Webpage**: Users must accept the T&Cs upon their first login to the Unique AI webpage.
- **App**: Users must accept the T&Cs upon their first login to the Unique AI app.

Acceptance of the T&Cs is essential for accessing Unique's services. Unique reserves the right to update the T&Cs periodically as needed.

In exceptional cases, the Client agrees in the Master Services Agreement to inform end users about the Terms and Conditions, ensure compliance, and allow for their **modification or deactivation.**

The Terms and Conditions Administration section provides guidelines for updating terms and conditions via API, ensuring that all legal and compliance requirements are met efficiently.

## Step-by-Step Guide

### Modifying Terms and Conditions

Only applicable if covered by a Master Service Agreement.

#### Step 1: Verify you have the eligible role
An admin user with the `chat.admin.all` permission is required to write the new version of the Terms & Conditions

| Operation                | Required Role   | Description                                                    | **Details**                                         |
|--------------------------|------------------|----------------------------------------------------------------|-----------------------------------------------------|
| `termsAndConditions`     | `CHAT_ADMIN_ALL` | Only administrators can view all terms and conditions           | [Understand Roles and Permissions](https://docs.unique.ai/it-operators/identity-and-access-management-iam/understand-roles-and-permissions) |

#### Step 2: Get an Auth Token
Get an Auth Token using this guideline: [How to get a Token for the GraphQL APIs](https://docs.unique.ai/developers/software-development-kit-sdk/apis-graphql-internal-apis-for-admins/how-to-get-a-token-for-the-graphql-apis)

Refer to [Multitenant Region URLs](https://docs.unique.ai/it-operators/installing-and-upgrading-unique/multitenant-region-urls) to find the correct base URL for your deployment.

In these examples, the `<HOST OF URL>` would usually look like this:

`https://gateway.<cluster>.unique.app`

or `https://gateway.<your_custom_url>`

#### Step 3: Use Command
Use this command to set it:

```
curl --location 'https://gateway.<baseUrl>/chat/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {TOKEN}' \
--data '{"query":"mutation createTermsAndConditions($termsAndConditions: String!) {\n  createTermsAndConditions(termsAndConditions: $termsAndConditions) {\n    id\n    text\n    isUniqueTermsAndConditions\n    createdBy\n    createdAt\n    companyId\n  }\n}","variables":{"termsAndConditions":"just a test\nmulti line\n# Titles work as well and markdown"}}'
```

You can use any markdown in the terms and conditions, as described here: [https://www.markdownguide.org/basic-syntax/](https://www.markdownguide.org/basic-syntax/)

### Disabling Terms and Conditions
Only applicable if covered by a Master Service Agreement.

**Follow step 1 and step 2 outlined above,** and by setting the Terms & Conditions to an **empty string**, the Terms and Conditions will be entirely removed during login.

### Exporting Terms and Conditions
**Follow step 1 and step 2 outlined above.**

The export operation retrieves all terms and conditions versions for the company. This is essential for administrative oversight, compliance auditing, and historical analysis.

**Required Role:** `CHAT_ADMIN_ALL` **Export Use Cases:**

```
bash

curl '<HOST OF URL>/chat/graphql' \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  --data '{
    "query": "query AllTermsAndConditions { termsAndConditions { id text createdAt createdBy } }"
  }'

curl '<HOST OF URL>/chat/graphql' -H 'Content-Type: application/json' -H 'Accept: application/json' --data-binary '{"query":"{  termsAndConditions {\n    TermsAndConditionsAgreement {\n      companyId\n      createdAt\n      id\n      termsAndConditionsId\n      updatedAt\n    }\n    _count {\n      TermsAndConditionsAgreement\n    }\n    companyId\n    createdAt\n    createdBy\n    id\n  }\n}","variables":{}}' --compressed
```

**Response:**

```
{
  "data": {
    "termsAndConditions": [
      {
        "TermsAndConditionsAgreement": [],
        "_count": {
          "TermsAndConditionsAgreement": 0
        },
        "companyId": "2253367030977701234",
        "createdAt": "2024-05-13T07:41:53.540Z",
        "createdBy": "2628413578679421234",
        "id": "tac_chw5k3mjwu8xgiwbkvzc2ida"
      },
      {
        "TermsAndConditionsAgreement": [
          {
            "companyId": "2253367030977701234",
            "createdAt": "2023-09-15T13:26:53.396Z",
            "id": "225352841538041234",
            "createdBy": "225352841538041234",
            "termsAndConditionsId": "tac_rdb9qb751s8y09i7c6qsirhn",
            "updatedAt": "2023-09-15T13:26:53.396Z"
          },
          {
            "companyId": "2253367030977701234",
            "createdAt": "2023-09-18T11:15:19.815Z",
            "id": "230675241901232312",
            "createdBy": "230675241901232312",
            "termsAndConditionsId": "tac_rdb9qb751s8y09i7c6qsirhn",
            "updatedAt": "2023-09-18T11:15:19.815Z"
          },
          {
            "companyId": "2253367030977701234",
            "createdAt": "2023-09-17T16:56:04.978Z",
            "id": "231988309117636667",
            "createdBy": "231988309117636667",
            "termsAndConditionsId": "tac_rdb9qb751s8y09i7c6qsirhn",
            "updatedAt": "2023-09-17T16:56:04.978Z"
          },
          {
            "companyId": "2253367030977701234",
            "createdAt": "2023-09-18T11:42:40.913Z",
            "id": "232433813626556475",
            "createdBy": "232433813626556475",
            "termsAndConditionsId": "tac_rdb9qb751s8y09i7c6qsirhn",
            "updatedAt": "2023-09-18T11:42:40.913Z"
          },
          {
            "companyId": "2253367030977701234",
            "createdAt": "2023-09-26T13:14:17.880Z",
            "id": "233602675839602747",
            "createdBy": "233602675839602747",
            "termsAndConditionsId": "tac_rdb9qb751s8y09i7c6qsirhn",
            "updatedAt": "2023-09-26T13:14:17.880Z"
          },
          {
            "companyId": "2253367030977701234",
            "createdAt": "2024-04-15T15:43:17.311Z",
            "id": "262898603356324081",
            "createdBy": "262898603356324081",
            "termsAndConditionsId": "tac_rdb9qb751s8y09i7c6qsirhn",
            "updatedAt": "2024-04-15T15:43:17.311Z"
          }
        ],
        "_count": {
          "TermsAndConditionsAgreement": 6
        },
        "companyId": "2253367030977701234",
        "createdAt": "2023-09-15T13:25:22.255Z",
        "createdBy": "225352841538041234",
        "id": "tac_rdb9qb751s8y09i7c6qsirhn"
      }
    ]
  }
}
```

The `TermsAndConditionsAgreement` contains the list of all users that have agreed to the terms and conditions. The `createdBy` is the userId of the user.

## Limitations

GraphQL requests are subject to standard rate limiting. For high-volume operations, implement appropriate delays between requests.
