API Documentation

Welcome to the Semantic Ink API. Convert documents to HTML or create charts from CSV data.

Document to HTML Conversion

POST /api/convert

Convert a document file to semantic HTML format.

Request Format

Send a multipart/form-data request with the following parameters:

  • file: The document file to convert (required, formats: PDF, DOCX, ODT)
  • target_format: Set to "semantic_html" (optional, default: "semantic_html")
  • start_page: Starting page number (optional, PDF only, default: 1)
  • end_page: Ending page number (optional, PDF only)

Response Format

{
    "status": "success",
    "result": "HTML content",
    "task_id": 123
}

CSV to Chart Conversion

POST /api/chart

Convert CSV data into chart format.

Request Format

Send a multipart/form-data request with the following parameters:

  • file: The CSV file to convert (required)
  • chart_type: Type of chart (optional, default: "line")
  • color_scheme: Color scheme to use (optional, default: "default")

Supported Chart Types

  • line
  • bar
  • pie
  • doughnut
  • radar

Supported Color Schemes

  • default
  • warm
  • cool
  • pastel
  • neon

Response Format

{
    "labels": ["Column1", "Column2", ...],
    "data": [[1, 2, 3], [4, 5, 6], ...],
    "chart_type": "line",
    "color_scheme": "default"
}

Example cURL Request

curl -X POST \
    -F "file=@data.csv" \
    -F "chart_type=bar" \
    -F "color_scheme=warm" \
    http://your-domain/api/chart

Citation Processing

POST /api/citations

Convert plain text citations into structured formats using various citation styles.

Request Format

Send a JSON request with the following parameters:

{
    "citations": "Citation text here...",
    "style": "american-psychological-association",
    "format": "text"
}

Supported Citation Styles

  • american-psychological-association (APA)
  • modern-language-association (MLA)
  • chicago-author-date
  • harvard-cite-them-right
  • ieee

Output Formats

  • html: Formatted HTML output
  • text: Plain text format
  • bibtex: BibTeX format
  • json: CSL JSON format

Response Format

{
    "status": "success",
    "citations": "Formatted citations..."
}

Example cURL Request

curl -X POST \
    -H "Content-Type: application/json" \
    -d '{"citations": "Author, A. (2023). Title...", "style": "apa", "format": "text"}' \
    http://your-domain/api/citations

Error Handling

The API uses standard HTTP status codes:

  • 200: Success
  • 400: Bad Request (invalid input)
  • 404: Not Found
  • 500: Internal Server Error

Error responses include a JSON object with an error message:

{
    "error": "Error description"
}