const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream'},
body: JSON.stringify('<string>')
};
fetch('https://api.context.dev/v1/parse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.context.dev/v1/parse"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/parse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/octet-stream'
request.body = "\"<string>\""
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/parse"
payload := strings.NewReader("\"<string>\"")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/parse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode('<string>'),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://api.context.dev/v1/parse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/octet-stream' \
--data '"<string>"'{
"success": true,
"markdown": "<string>",
"type": "html",
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INPUT_VALIDATION_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INPUT_VALIDATION_ERROR"
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "UNSUPPORTED_CONTENT",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Parse a file
Convert uploaded file bytes into Markdown and optional HTML.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream'},
body: JSON.stringify('<string>')
};
fetch('https://api.context.dev/v1/parse', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.context.dev/v1/parse"
payload = "<string>"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/parse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/octet-stream'
request.body = "\"<string>\""
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.context.dev/v1/parse"
payload := strings.NewReader("\"<string>\"")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.context.dev/v1/parse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode('<string>'),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}curl --request POST \
--url https://api.context.dev/v1/parse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/octet-stream' \
--data '"<string>"'{
"success": true,
"markdown": "<string>",
"type": "html",
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INPUT_VALIDATION_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INPUT_VALIDATION_ERROR"
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "UNSUPPORTED_CONTENT",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"request_id": "3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91",
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Authorizations
Send Authorization: Bearer <API_KEY>. Keys have full access unless restricted to scopes.
Query Parameters
Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.
txt, text, md, markdown, html, htm, xhtml, xml, rss, atom, csv, tsv, yaml, yml, py, java, js, jsx, mjs, cjs, json, jsonl, ndjson, php, sh, bash, zsh, fish, rb, ts, tsx, rtf, srt, css, scss, less, styl, sass, svg, pdf, docx, doc, xlsx, xlsm, xlsb, xltx, xltm, xls, pptx, pptm, ppsx, ppsm, potx, potm, ppt, pps, pot, jpg, jpeg, jpe, png, gif, bmp, tiff, tif, webp, ppm, pbm, pgm, pnm Preserve hyperlinks in Markdown output
Include image references in Markdown output
Shorten base64-encoded image data in the Markdown output
Extract only the main content from HTML-like inputs
Read text from images and scanned PDF pages. PDF page ranges still apply.
PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}.
Show child attributes
Show child attributes
Optional client identifier used for usage attribution.
1 - 100enabled turns on zero data retention. Returns 403 ZDR_NOT_ENABLED unless your organization has ZDR.
enabled, disabled Comma-separated labels for filtering usage, e.g. production,team-alpha.
Labels for filtering usage in the dashboard.
201 - 50["production", "team-alpha"]
Body
Raw file bytes, up to 50 MiB.
The body is of type file.
Response
Successful response
Indicates success
true Input bytes converted to GitHub Flavored Markdown
Detected content type used for parsing
html, xml, json, jsonl, text, csv, tsv, markdown, yaml, python, java, javascript, php, shell, ruby, typescript, rtf, srt, css, scss, less, stylus, sass, svg, pdf, docx, doc, xlsx, xls, pptx, ppt, jpg, png, gif, bmp, tiff, webp, ppm, pbm, pgm, pnm Unique ID of this request, also in X-Request-Id. Include it when contacting support.
"3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
Credits this request used and your remaining balance.
Show child attributes
Show child attributes
Was this page helpful?