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.",
"tags": [
"authentication",
"security",
"api",
"sessions"
]
}'
{
  "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"
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Headers

X-Organization-Id
string

Organization ID (required for session auth, optional for API key auth)

Body

application/json

Context entry data

question
string
required

The question or topic this context entry addresses

Example:

"How do we handle user authentication in our application?"

answer
string
required

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
string[]

Tags to categorize and help search this context entry

Example:
[
"authentication",
"security",
"api",
"sessions"
]

Response

Context entry created successfully

id
string
organizationId
string
question
string
answer
string
tags
string[]
createdAt
string<date-time>
updatedAt
string<date-time>
authType
enum<string>
Available options:
api-key,
session