curl --request POST \
--url https://api.trycomp.ai/v1/context \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"question": "How do we handle user authentication in our application?",
"answer": "We use a hybrid authentication system supporting both API keys and session-based authentication. API keys are used for programmatic access while sessions are used for web interface interactions."
}
'{
"id": "ctx_abc123def456",
"organizationId": "org_xyz789uvw012",
"question": "How do we handle user authentication in our application?",
"answer": "We use a hybrid authentication system supporting both API keys and session-based authentication.",
"tags": [
"authentication",
"security",
"api",
"sessions"
],
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"authType": "apikey"
}{
"message": [
"question should not be empty",
"answer should not be empty"
],
"error": "Bad Request",
"statusCode": 400
}{
"message": "Unauthorized",
"statusCode": 401
}{
"message": "Organization not found",
"statusCode": 404
}{
"message": "Internal server error",
"statusCode": 500
}Context
Create a new context entry | Comp AI API
Creates a new context entry for the authenticated organization. All required fields must be provided.
POST
/
v1
/
context
curl --request POST \
--url https://api.trycomp.ai/v1/context \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"question": "How do we handle user authentication in our application?",
"answer": "We use a hybrid authentication system supporting both API keys and session-based authentication. API keys are used for programmatic access while sessions are used for web interface interactions."
}
'{
"id": "ctx_abc123def456",
"organizationId": "org_xyz789uvw012",
"question": "How do we handle user authentication in our application?",
"answer": "We use a hybrid authentication system supporting both API keys and session-based authentication.",
"tags": [
"authentication",
"security",
"api",
"sessions"
],
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z",
"authType": "apikey"
}{
"message": [
"question should not be empty",
"answer should not be empty"
],
"error": "Bad Request",
"statusCode": 400
}{
"message": "Unauthorized",
"statusCode": 401
}{
"message": "Organization not found",
"statusCode": 404
}{
"message": "Internal server error",
"statusCode": 500
}Authorizations
API key for authentication
Body
application/json
Context entry data
The question or topic this context entry addresses
Example:
"How do we handle user authentication in our application?"
The answer or detailed explanation for the question
Example:
"We use a hybrid authentication system supporting both API keys and session-based authentication. API keys are used for programmatic access while sessions are used for web interface interactions."
Tags to categorize and help search this context entry
Example:
[
"authentication",
"security",
"api",
"sessions"
]
Was this page helpful?

