Skip to content

Commit d332751

Browse files
authored
docs: cloud embedding api (#10137)
* docs: cloud embedding api * fix
1 parent 9915102 commit d332751

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/pages/product/apis-integrations/embedding.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,21 @@ Use the `/api/v1/embed/generate-session` endpoint to create a session for your u
3535
</WarningBox>
3636

3737

38+
#### Request parameters
39+
40+
- **`deploymentId`** (required): The deployment ID to scope the session to. This ensures tokens and access are limited to a specific deployment and model, providing better security isolation.
41+
- **`externalId`** (required): A unique identifier for your user (e.g., email, user ID)
42+
- **`userAttributes`** (optional): Array of attributes for row-level security and personalized responses
43+
44+
<InfoBox>
45+
The `deploymentId` parameter is required for security purposes. It scopes the generated session token to a specific deployment and data model, preventing unauthorized access across different deployments or models.
46+
</InfoBox>
47+
3848
#### Example (JavaScript)
3949

4050
```javascript
4151
const API_KEY = "YOUR_API_KEY";
52+
const DEPLOYMENT_ID = 32;
4253

4354
const session = await fetch(
4455
"https://your-tenant.cubecloud.dev/api/v1/embed/generate-session",
@@ -49,6 +60,7 @@ const session = await fetch(
4960
Authorization: "Access-Token ${API_KEY}",
5061
},
5162
body: JSON.stringify({
63+
deploymentId: DEPLOYMENT_ID,
5264
externalId: "[email protected]",
5365
userAttributes: [
5466
// optional - enables row-level security
@@ -99,6 +111,7 @@ Here's a complete HTML example that demonstrates the full flow for embedding a d
99111
(async () => {
100112
const API_BASE_URL = "https://your-tenant.cubecloud.dev";
101113
const API_KEY = "YOUR_API_KEY";
114+
const DEPLOYMENT_ID = 32;
102115
const externalId = "[email protected]";
103116
104117
const sessionResponse = await fetch(
@@ -110,6 +123,7 @@ Here's a complete HTML example that demonstrates the full flow for embedding a d
110123
Authorization: `Access-Token ${API_KEY}`,
111124
},
112125
body: JSON.stringify({
126+
deploymentId: DEPLOYMENT_ID,
113127
externalId: externalId,
114128
}),
115129
},
@@ -165,6 +179,7 @@ User attributes enable row-level security and personalized chat responses by fil
165179
## Security considerations
166180

167181
- **API Key Security**: Keep your API keys secure and never expose them in client-side code
182+
- **Deployment Scoping**: The required `deploymentId` parameter ensures that generated session tokens are scoped to a specific deployment and data model. This provides isolation between different deployments and prevents unauthorized cross-deployment access.
168183
- **Session Management**: Sessions are temporary and should be regenerated as needed
169184
- **HTTPS**: Always use HTTPS in production environments
170185

@@ -187,4 +202,4 @@ If you encounter issues with dashboard embedding:
187202
- Contact support if you need assistance with configuration
188203

189204

190-
[ref-api-keys]: /product/workspace/api-keys
205+
[ref-api-keys]: /product/workspace/api-keys

0 commit comments

Comments
 (0)