Skip to main content

Generate Citation

Generate a properly formatted citation from source data.
Authentication is optional. Authenticated users can save citations to their history.
POST /api/citations/generate
curl -X POST https://api.inspir.uk/api/citations/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "citationType": "book",
    "citationStyle": "MLA",
    "sourceData": {
      "author": "Smith, John",
      "title": "The Great Example",
      "publisher": "Academic Press",
      "year": "2023",
      "location": "New York"
    }
  }'

Request Parameters

citationType
string
required
Type of source to cite. Options:
  • book
  • article
  • website
  • journal
  • newspaper
  • video
  • podcast
citationStyle
string
required
Citation format style. Options:
  • MLA - Modern Language Association
  • APA - American Psychological Association
  • Chicago - Chicago Manual of Style
  • Harvard - Harvard referencing system
sourceData
object
required
Source information fields. Required fields vary by citation type.

Response

citation
string
The formatted citation string
saved
boolean
Whether the citation was saved to user’s history
citationId
string
Unique identifier for the saved citation (only if saved is true)
data
object
Complete database record (only if saved is true)

Error Responses


Get Citation History

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

Query Parameters

style
string
Filter by citation style (MLA, APA, Chicago, Harvard)
type
string
Filter by citation type (book, article, website, etc.)
limit
number
Number of results to return. Default: 50
offset
number
Number of results to skip (for pagination). Default: 0

Response

citations
array
Array of saved citations
total
number
Total count of citations
limit
number
Limit applied
offset
number
Offset applied

Get Citation by ID

Retrieve a specific citation.
This endpoint requires authentication. You can only access your own citations.
GET /api/citations/:id
curl -X GET https://api.inspir.uk/api/citations/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

id
string
required
The unique identifier of the citation

Response

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

Error Responses


Update Citation

Update a saved citation. Automatically regenerates the formatted citation if source data changes.
This endpoint requires authentication. You can only update your own citations.
PUT /api/citations/:id
curl -X PUT https://api.inspir.uk/api/citations/123e4567-e89b-12d3-a456-426614174000 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "citationStyle": "APA",
    "sourceData": {
      "author": "Smith, John",
      "title": "The Great Example (2nd ed.)",
      "publisher": "Academic Press",
      "year": "2024"
    }
  }'

Path Parameters

id
string
required
The unique identifier of the citation

Request Parameters

citationType
string
Updated citation type
citationStyle
string
Updated citation style
sourceData
object
Updated source data

Response

Returns the updated citation object.

Delete Citation

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

Path Parameters

id
string
required
The unique identifier of the citation

Response

{
  "message": "Citation deleted successfully"
}

Create Bibliography Project

Create a new bibliography project to organize multiple citations.
This endpoint requires authentication.
POST /api/citations/projects
curl -X POST https://api.inspir.uk/api/citations/projects \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "projectName": "Research Paper 2024",
    "description": "Citations for my thesis on climate change",
    "defaultStyle": "APA"
  }'

Request Parameters

projectName
string
required
Name of the bibliography project
description
string
Optional description of the project
defaultStyle
string
Default citation style for the project. Default: "MLA"

Response

Returns the created project object:
id
string
Project ID
user_id
string
Owner’s user ID
project_name
string
Project name
description
string
Project description
default_style
string
Default citation style
created_at
string
ISO 8601 timestamp

Error Responses


Get Projects

Retrieve all bibliography projects for the authenticated user.
This endpoint requires authentication.
GET /api/citations/projects/list
curl -X GET https://api.inspir.uk/api/citations/projects/list \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

Returns an array of project objects, sorted by creation date (newest first).

Export Bibliography

Export all citations in a project as a formatted bibliography.
This endpoint requires authentication. You can only export your own projects.
GET /api/citations/projects/:projectId/export
curl -X GET "https://api.inspir.uk/api/citations/projects/123e4567-e89b-12d3-a456-426614174000/export?format=text" \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

projectId
string
required
The unique identifier of the project

Query Parameters

format
string
Export format. Options:
  • text (default): Plain text bibliography with one citation per line
  • json: JSON array of citation objects
  • bibtex: BibTeX format for LaTeX documents

Response

Returns the formatted bibliography as plain text, JSON, or BibTeX depending on the format parameter.

Error Responses

Build docs developers (and LLMs) love