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

# User Management

> Usage patterns for user management endpoints

## User Creation and Management Flow

All user-related operations require users to be created first in the system.

### Create User

```bash cURL theme={null}
curl -X POST "https://connect.cariqa.com/api/v1/users/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "locale": "de",
    "custom_properties": {
        "external_id": "abcdefg123456"
    }
  }'
```

```python Python theme={null}
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

data = {
    "email": "user@example.com",
    "locale": "de",
    "custom_properties": {
        "external_id": "abcdefg123456"
    }
}

response = requests.post(
    "https://connect.cariqa.com/api/v1/users/",
    headers=headers,
    json=data
)
```

```javascript JavaScript theme={null}
const response = await fetch('https://connect.cariqa.com/api/v1/users/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    email: 'user@example.com',
    locale: 'de',
    custom_properties: {
        'external_id': 'abcdefg123456'
    }
  })
});
```

Response:

```json theme={null}
{
  "id": "72794486-bf87-44fb-9b74-5b8fed6c994d",
  "email": "user@example.com",
  "locale": "de",
  "external_id": {
    "external_id": "abcdefg123456"
  }
}
```

### List Users Before Selection

```bash cURL theme={null}
curl -X GET "https://connect.cariqa.com/api/v1/users/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
```

```python Python theme={null}
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.get(
    "https://connect.cariqa.com/api/v1/users/",
    headers=headers
)
```

```javascript JavaScript theme={null}
const response = await fetch('https://connect.cariqa.com/api/v1/users/', {
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});
```

Response:

```json theme={null}
{
  "count": 3,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "29b8c323-eaf8-487a-a43d-0d37dd7328f1",
      "email": "user1@example.com",
      "locale": "en",
      "custom_properties": null
    },
    {
      "id": "72794486-bf87-44fb-9b74-5b8fed6c994d",
      "email": "user@example.com",
      "locale": "de",
      "custom_properties": {
        "external_id": "abcdefg123456"
      }
    },
    {
      "id": "db48d284-d67b-4e71-9065-1ef0e1b062d0",
      "email": "user@example.com",
      "locale": "de",
      "custom_properties": {
        "external_id": null
      }
    }
  ]
}
```

### Retrieve User Details

```bash cURL theme={null}
curl -X GET "https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "locale": "en"
  }'
```

```python Python theme={null}
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.get(
    "https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/",
    headers=headers
)
```

```javascript JavaScript theme={null}
const response = await fetch('https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});
```

Response:

```json theme={null}
{
  "id": "72794486-bf87-44fb-9b74-5b8fed6c994d",
  "email": "user@example.com",
  "locale": "de",
  "custom_properties": {
    "external_id": "abcdefg123456"
  }
}
```

### Update User Details

```bash cURL theme={null}
curl -X PATCH "https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "locale": "en"
  }'
```

```python Python theme={null}
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

data = {"locale": "en"}

response = requests.patch(
    "https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/",
    headers=headers,
    json=data
)
```

```javascript JavaScript theme={null}
const response = await fetch('https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    locale: 'en'
  })
});
```

Response:

```json theme={null}
{
  "id": "72794486-bf87-44fb-9b74-5b8fed6c994d",
  "email": "user@example.com",
  "locale": "en",
  "custom_properties": {
    "external_id": "abcdefg123456"
  }
}
```

### Soft Delete User

```bash cURL theme={null}
curl -X DELETE "https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"
```

```python Python theme={null}
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

response = requests.delete(
    "https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/",
    headers=headers
)
```

```javascript JavaScript theme={null}
const response = await fetch('https://connect.cariqa.com/api/v1/users/72794486-bf87-44fb-9b74-5b8fed6c994d/', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});
```

## Key Implementation Notes

* **Client Scoping**: API automatically validates ownership - users are scoped to the authenticated client
* **Email Uniqueness**: Email addresses are not unique across the system and are optional
* **External id**: Set external ids of the users and use them to search users
* **Soft Delete**: Users are marked as deleted but data is preserved for compliance
* **Automatic Validation**: No need to manually verify user ownership before calling detail endpoints


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.