# Agreements

Read more about agreements from [Agreements & Compliance documentation](https://prompteasy.eu/docs/administration/agreements).

## Check agreement signature compliance status

`GET /v1/agreements/check`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `agreement_for` (query, string, optional) - Specific contract type to check (e.g., tos, privacy, custody, high_risk_ai). If provided, returns a simple boolean indicating whether the latest version is signed.
  Type: string

Responses:

- 200: Agreement compliance check results.

Content type: application/json

Type: unknown

oneOf:
  Type: boolean
  
  Return value when querying with agreement_for.

  Type: object
  
  Return value when querying without agreement_for.
  
  - `required` (required)
    Type: array
    
    List of required contracts missing agreement for latest version.
    
    Items:
      Type: string
  
  - `optional` (required)
    Type: array
    
    List of optional contracts missing agreement for latest version.
    
    Items:
      Type: string

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/agreements/check' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/agreements/check', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/agreements/check',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List all signed agreements for the tenant

`GET /v1/agreements`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Responses:

- 200: A list of signed agreements

Content type: application/json

Type: array

Items:
  Reference: [Agreement](https://api.prompteasy.eu/docs/api/models/agreement/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/agreements' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/agreements', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/agreements',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get details of a specific signed agreement

`GET /v1/agreements/{agreement}`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `agreement` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Agreement details

Content type: application/json

Type: object

Schema: [Agreement](https://api.prompteasy.eu/docs/api/models/agreement/index.md)

- `id` (optional)
  Type: string, uuid
  
  Example:
  
  ```json
  "9b2d5a39-ec9b-4b21-b3b4-4ffc8b671a53"
  ```

- `tenant_id` (optional)
  Type: string, uuid
  
  Example:
  
  ```json
  "a81d4a03-7cf5-4cf0-9dc8-f5e1823793df"
  ```

- `tenant_name` (optional)
  Type: string
  
  Example:
  
  ```json
  "Acme Inc."
  ```

- `contract_id` (optional)
  Type: string, uuid
  
  Example:
  
  ```json
  "9b2d5a39-ec9b-4b21-b3b4-4ffc8b671a53"
  ```

- `signatory` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `signature_hash` (optional)
  Type: string
  
  Example:
  
  ```json
  "5e8837e8f7dbe4f9d788c0ab58807d893d79a250781cde2415d860341b12b322"
  ```

- `created_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-11-25T13:12:29+00:00"
  ```

- `updated_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-11-25T13:12:29+00:00"
  ```

- `contract` (optional)
  Reference: [Contract](https://api.prompteasy.eu/docs/api/models/contract/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

- 404: Not Found

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/agreements/550e8400-e29b-41d4-a716-446655440000' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/agreements/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/agreements/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Sign a contract

`POST /v1/agreements/{contract}/{user}/sign`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `contract` (path, string, uuid, required)
  Type: string, uuid

- `user` (path, integer, required)
  Type: integer

Request body: application/json (required)

Type: object

Schema: [SignAgreementRequest](https://api.prompteasy.eu/docs/api/models/signagreementrequest/index.md)

- `name` (required)
  Type: string
  
  Must exactly match the user's name
  
  Example:
  
  ```json
  "John Doe"
  ```

Responses:

- 201: Contract successfully signed

Content type: application/json

Type: object

Schema: [Agreement](https://api.prompteasy.eu/docs/api/models/agreement/index.md)

- `id` (optional)
  Type: string, uuid
  
  Example:
  
  ```json
  "9b2d5a39-ec9b-4b21-b3b4-4ffc8b671a53"
  ```

- `tenant_id` (optional)
  Type: string, uuid
  
  Example:
  
  ```json
  "a81d4a03-7cf5-4cf0-9dc8-f5e1823793df"
  ```

- `tenant_name` (optional)
  Type: string
  
  Example:
  
  ```json
  "Acme Inc."
  ```

- `contract_id` (optional)
  Type: string, uuid
  
  Example:
  
  ```json
  "9b2d5a39-ec9b-4b21-b3b4-4ffc8b671a53"
  ```

- `signatory` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `signature_hash` (optional)
  Type: string
  
  Example:
  
  ```json
  "5e8837e8f7dbe4f9d788c0ab58807d893d79a250781cde2415d860341b12b322"
  ```

- `created_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-11-25T13:12:29+00:00"
  ```

- `updated_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-11-25T13:12:29+00:00"
  ```

- `contract` (optional)
  Reference: [Contract](https://api.prompteasy.eu/docs/api/models/contract/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

- 422: Unprocessable Entity

Content type: application/json

Type: object

Schema: [ValidationError](https://api.prompteasy.eu/docs/api/models/validationerror/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Validation failed"
  ```

- `errors` (optional)
  Reference: [ValidationErrorErrors](https://api.prompteasy.eu/docs/api/models/validationerrorerrors/index.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'https://api.prompteasy.eu/v1/agreements/550e8400-e29b-41d4-a716-446655440000/0/sign' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "John Doe"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "John Doe"
}`;

const response = await fetch('https://api.prompteasy.eu/v1/agreements/550e8400-e29b-41d4-a716-446655440000/0/sign', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "name": "John Doe"
}'''

response = requests.post(
    'https://api.prompteasy.eu/v1/agreements/550e8400-e29b-41d4-a716-446655440000/0/sign',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
