Skip to content

Create a new context entry

POST
/v1/context
curl --request POST \
--url https://api.varman.io/v1/context \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-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" ] }'

Creates a new context entry for the authenticated organization. All required fields must be provided.

Context entry data

Media typeapplication/json
object
question
required

The question or topic this context entry addresses

string
answer
required

The answer or detailed explanation for the question

string
tags

Tags to categorize and help search this context entry

Array<string>
section

Org profile section the entry belongs to, for example Company, Team or Technology. Omit for general entries.

string
status

Answered (default), unsure when the team does not understand the question (owners and admins are emailed), or skipped. The answer may be empty unless answered.

string
Allowed values: answered unsure skipped

Examples

{
"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"
]
}

Context entry created successfully

Media typeapplication/json
object
id
string
organizationId
string
question
string
answer
string
tags
Array<string>
createdAt
string format: date-time
updatedAt
string format: date-time
authType
string
Allowed values: api-key session

Example

{
"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"
}

Bad request - Invalid input data

Media typeapplication/json
object
message
Array<string>
error
string
statusCode
number

Example

{
"message": [
"question should not be empty",
"answer should not be empty"
],
"error": "Bad Request",
"statusCode": 400
}

Unauthorized - Invalid or missing authentication

Media typeapplication/json
object
message
string
statusCode
number

Example

{
"message": "Unauthorized",
"statusCode": 401
}

Organization not found

Media typeapplication/json
object
message
string
statusCode
number

Example

{
"message": "Organization not found",
"statusCode": 404
}

Internal server error

Media typeapplication/json
object
message
string
statusCode
number

Example

{
"message": "Internal server error",
"statusCode": 500
}