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

# Settings

> Manage workspace settings, user preferences, and API keys

## Get Workspace Settings

Retrieve workspace configuration and user profile information.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.gostanna.com/api/settings?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings?workspaceId=yourcompany.com', {
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });

  const settings = await response.json();
  ```

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

  response = requests.get(
      'https://api.gostanna.com/api/settings',
      params={'workspaceId': 'yourcompany.com'},
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  settings = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "profile": {
    "name": "John Doe",
    "email": "john.doe@yourcompany.com",
    "title": "Customer Success Manager"
  },
  "workspace": {
    "workspaceName": "Your Company",
    "domain": "yourcompany.com",
    "timezone": "America/New_York",
    "currency": "USD",
    "defaultWindowDays": 7,
    "riskThreshold": 40,
    "dataRetentionDays": 365,
    "notifications": {
      "channels": {
        "email": true
      },
      "dailyDigest": false,
      "weeklyDigest": true,
      "alertOnScoreDrop": true,
      "scoreDropPct": 10,
      "alertOnRenewals": true,
      "renewalsAheadDays": 30,
      "emailFrom": "notifications@yourcompany.com"
    }
  }
}
```

***

## Update Workspace Settings

Update workspace configuration and user profile information.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

<ParamField body="profile" type="object">
  User profile information
</ParamField>

<ParamField body="workspace" type="object">
  Workspace configuration
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.gostanna.com/api/settings?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{
      "profile": {
        "name": "John Doe",
        "title": "Senior Customer Success Manager"
      },
      "workspace": {
        "timezone": "America/Los_Angeles",
        "currency": "USD",
        "defaultWindowDays": 14,
        "riskThreshold": 35,
        "notifications": {
          "dailyDigest": true,
          "weeklyDigest": true,
          "alertOnScoreDrop": true,
          "scoreDropPct": 15
        }
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings?workspaceId=yourcompany.com', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      profile: {
        name: 'John Doe',
        title: 'Senior Customer Success Manager'
      },
      workspace: {
        timezone: 'America/Los_Angeles',
        currency: 'USD',
        defaultWindowDays: 14,
        riskThreshold: 35,
        notifications: {
          dailyDigest: true,
          weeklyDigest: true,
          alertOnScoreDrop: true,
          scoreDropPct: 15
        }
      }
    })
  });

  const result = await response.json();
  ```

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

  response = requests.put(
      'https://api.gostanna.com/api/settings',
      params={'workspaceId': 'yourcompany.com'},
      json={
          'profile': {
              'name': 'John Doe',
              'title': 'Senior Customer Success Manager'
          },
          'workspace': {
              'timezone': 'America/Los_Angeles',
              'currency': 'USD',
              'defaultWindowDays': 14,
              'riskThreshold': 35,
              'notifications': {
                  'dailyDigest': True,
                  'weeklyDigest': True,
                  'alertOnScoreDrop': True,
                  'scoreDropPct': 15
              }
          }
      },
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  result = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "message": "Settings updated successfully"
}
```

***

## List API Keys

Retrieve all API keys for your workspace.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.gostanna.com/api/settings/api-keys?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings/api-keys?workspaceId=yourcompany.com', {
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });

  const apiKeys = await response.json();
  ```

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

  response = requests.get(
      'https://api.gostanna.com/api/settings/api-keys',
      params={'workspaceId': 'yourcompany.com'},
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  api_keys = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "apiKeys": [
    {
      "id": "key_abc123",
      "name": "Production Dashboard",
      "key": "sk-abc123...xyz789",
      "lastUsedAt": "2024-01-31T10:30:00Z",
      "isActive": true,
      "createdAt": "2024-01-01T00:00:00Z"
    },
    {
      "id": "key_def456",
      "name": "Mobile App",
      "key": "sk-def456...uvw123",
      "lastUsedAt": null,
      "isActive": true,
      "createdAt": "2024-01-15T12:00:00Z"
    }
  ]
}
```

***

## Create API Key

Generate a new API key for your workspace.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

<ParamField body="name" type="string" required>
  Descriptive name for the API key
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.gostanna.com/api/settings/api-keys?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "New Integration Key",
      "workspaceId": "yourcompany.com"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings/api-keys?workspaceId=yourcompany.com', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'New Integration Key',
      workspaceId: 'yourcompany.com'
    })
  });

  const result = await response.json();
  ```

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

  response = requests.post(
      'https://api.gostanna.com/api/settings/api-keys',
      params={'workspaceId': 'yourcompany.com'},
      json={
          'name': 'New Integration Key',
          'workspaceId': 'yourcompany.com'
      },
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  result = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "message": "API key created successfully",
  "apiKey": {
    "id": "key_ghi789",
    "name": "New Integration Key",
    "key": "sk-ghi789mnopqrstuvwxyz123456",
    "isActive": true,
    "createdAt": "2024-01-31T10:30:00Z"
  }
}
```

<Warning>
  The full API key is only shown once during creation. Store it securely as you won't be able to retrieve it again.
</Warning>

***

## Delete API Key

Remove an API key from your workspace.

<ParamField path="keyId" type="string" required>
  The API key ID to delete
</ParamField>

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.gostanna.com/api/settings/api-keys/key_ghi789?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings/api-keys/key_ghi789?workspaceId=yourcompany.com', {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });

  const result = await response.json();
  ```

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

  response = requests.delete(
      'https://api.gostanna.com/api/settings/api-keys/key_ghi789',
      params={'workspaceId': 'yourcompany.com'},
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  result = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "message": "API key deleted successfully"
}
```

***

## Test Email Notifications

Send a test notification email to verify your notification settings.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

<ParamField path="channel" type="string" required>
  Notification channel to test (currently only `email` is supported)
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.gostanna.com/api/notifications/test?workspaceId=yourcompany.com&channel=email" \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/notifications/test?workspaceId=yourcompany.com&channel=email', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });

  const result = await response.json();
  ```

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

  response = requests.post(
      'https://api.gostanna.com/api/notifications/test',
      params={
          'workspaceId': 'yourcompany.com',
          'channel': 'email'
      },
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  result = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "message": "Test email sent successfully to john.doe@yourcompany.com"
}
```

***

## Complete Onboarding

Mark user onboarding as complete to update their status.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.gostanna.com/api/settings/complete-onboarding?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings/complete-onboarding?workspaceId=yourcompany.com', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });

  const result = await response.json();
  ```

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

  response = requests.post(
      'https://api.gostanna.com/api/settings/complete-onboarding',
      params={'workspaceId': 'yourcompany.com'},
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  result = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "hasCompletedOnboarding": true
}
```

***

## Get User Information

Retrieve detailed user information and onboarding status.

<ParamField path="workspaceId" type="string" required>
  Your workspace domain
</ParamField>

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.gostanna.com/api/settings/user?workspaceId=yourcompany.com" \
    -H "Authorization: Bearer sk-your-api-key-here"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.gostanna.com/api/settings/user?workspaceId=yourcompany.com', {
    headers: {
      'Authorization': 'Bearer sk-your-api-key-here'
    }
  });

  const user = await response.json();
  ```

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

  response = requests.get(
      'https://api.gostanna.com/api/settings/user',
      params={'workspaceId': 'yourcompany.com'},
      headers={'Authorization': 'Bearer sk-your-api-key-here'}
  )

  user = response.json()
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "user": {
    "email": "john.doe@yourcompany.com",
    "name": "John Doe",
    "title": "Customer Success Manager",
    "hasCompletedOnboarding": true,
    "createdAt": "2024-01-01T00:00:00Z",
    "lastLoginAt": "2024-01-31T09:15:00Z"
  },
  "workspace": {
    "domain": "yourcompany.com",
    "name": "Your Company",
    "plan": "professional",
    "billingStatus": "active"
  }
}
```
