Create a new context entry
POST
/v1/context
const url = 'https://api.varman.io/v1/context';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"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"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”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
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" ]}{ "question": "What database do we use and why?", "answer": "We use PostgreSQL as our primary database with Prisma as the ORM. PostgreSQL provides excellent performance, ACID compliance, and supports advanced features like JSON columns and full-text search.", "tags": [ "database", "postgresql", "prisma", "architecture" ]}Responses
Section titled “Responses”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
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}