Skip to main content

Ask a Question

Submit a question to get an AI-powered solution with step-by-step explanations.
Authentication is optional. Authenticated users can save solutions to their history.
POST /api/doubt/ask
curl -X POST https://api.inspir.uk/api/doubt/ask \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "question_text": "What is the derivative of x^2 + 3x + 5?",
    "subject": "Mathematics",
    "source_type": "text"
  }'

Request Parameters

question_text
string
required
The question to solve. Must be at least 5 characters long.
subject
string
Subject area of the question (e.g., “Mathematics”, “Physics”, “Chemistry”). Helps the AI provide more contextually relevant answers.
source_type
string
Type of question source. Options: "text" or "image". Default: "text"
image_url
string
URL of an uploaded image containing the question (if source_type is “image”)
extracted_text
string
Text extracted from an image (if applicable)

Response

solution
string
Complete solution text
steps
array
Array of step-by-step solution explanations
key_concepts
array
Array of key concepts covered in the solution
difficulty
string
Estimated difficulty level (e.g., “Beginner”, “Intermediate”, “Advanced”)
saved
boolean
Whether the solution was saved to user’s history (true for authenticated users)
doubtId
string
Unique identifier for the saved solution (only present if saved is true)
data
object
Complete database record of the saved solution (only present if saved is true)

Error Responses


Upload and Extract Image

Extract text from an image using Claude Vision API before submitting a question.
POST /api/doubt/upload-image
curl -X POST https://api.inspir.uk/api/doubt/upload-image \
  -H "Content-Type: application/json" \
  -d '{
    "imageBase64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA..."
  }'

Request Parameters

imageBase64
string
required
Base64-encoded image data (with or without data URI prefix). Maximum size: 10MB.

Response

extracted_text
string
Text extracted from the image
detected_subject
string
Auto-detected subject area based on image content
confidence
number
Confidence score for the extraction (0-1)

Error Responses


Get Doubt History

Retrieve all saved doubt solutions for the authenticated user.
This endpoint requires authentication.
GET /api/doubt/history
curl -X GET "https://api.inspir.uk/api/doubt/history?subject=Mathematics&limit=50&offset=0" \
  -H "Authorization: Bearer YOUR_TOKEN"

Query Parameters

subject
string
Filter by subject. Use "all" or omit to get all subjects.
limit
number
Number of results to return. Default: 50
offset
number
Number of results to skip (for pagination). Default: 0

Response

doubts
array
Array of saved doubt solutions
limit
number
Limit applied to the query
offset
number
Offset applied to the query

Get Specific Doubt

Retrieve details of a specific doubt solution.
GET /api/doubt/:id
curl -X GET https://api.inspir.uk/api/doubt/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

id
string
required
The unique identifier of the doubt

Response

Returns a single doubt object with the same structure as the history endpoint.

Error Responses


Update Doubt

Update properties of a saved doubt solution.
This endpoint requires authentication. You can only update your own doubts.
PUT /api/doubt/:id
curl -X PUT https://api.inspir.uk/api/doubt/123e4567-e89b-12d3-a456-426614174000 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "is_public": true
  }'

Path Parameters

id
string
required
The unique identifier of the doubt

Request Parameters

is_public
boolean
Whether the solution should be publicly visible

Response

Returns the updated doubt object.

Delete Doubt

Delete a saved doubt solution.
This endpoint requires authentication. You can only delete your own doubts.
DELETE /api/doubt/:id
curl -X DELETE https://api.inspir.uk/api/doubt/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

id
string
required
The unique identifier of the doubt

Response

{
  "message": "Doubt deleted successfully"
}

Generate a shareable link for a doubt solution.
This endpoint requires authentication. You can only share your own doubts.
POST /api/doubt/:doubtId/share
curl -X POST https://api.inspir.uk/api/doubt/123e4567-e89b-12d3-a456-426614174000/share \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

doubtId
string
required
The unique identifier of the doubt to share

Response

share_token
string
Unique token for the shared doubt
share_url
string
Complete shareable URL
data
object
Share record from database

Get Shared Doubt

Retrieve a publicly shared doubt solution using its share token.
GET /api/doubt/shared/:shareToken
curl -X GET https://api.inspir.uk/api/doubt/shared/abc123def456

Path Parameters

shareToken
string
required
The share token for the doubt

Response

Returns the complete doubt object. Also increments the view count for the shared solution.
views_count
number
Number of times this solution has been viewed

Error Responses


Get Recent Solutions

Retrieve recently shared public doubt solutions.
GET /api/doubt/recent
curl -X GET "https://api.inspir.uk/api/doubt/recent?limit=10"

Query Parameters

limit
number
Number of solutions to return. Default: 10

Response

solutions
array
Array of public solutions (limited fields for preview)

Build docs developers (and LLMs) love