KERNIT Documentation
POST
/hyperlinkPOST /hyperlink
/hyperlink is the direct one-step endpoint. It is useful for trusted automated workflows, but KERNIT recommends scan/resolve/apply when users need to review wrong-link risk.
POST
/hyperlink
One-step DOCX hyperlinking#
Uploads a DOCX and returns linked output without an intermediate review step. Use scan/resolve/apply when wrong-link correction matters.
Contract Source#
This reference is backed by /docs/openapi.json. The source schema lives in app/docs/openapi.json, so request fields, response schemas, examples, and validation stay tied to one API contract.
Request Fields#
Defined by the OpenAPI contract requestBody multipart/form-data.
| Field | Type | Required | Description |
|---|---|---|---|
file | string:binary | Yes | Valid DOCX package. |
settings | string | No | JSON string matching HyperlinkSettings. |
Example Request#
curl -X POST https://api.kernit.org/hyperlink \
-H "Authorization: Bearer sk_kernit_live_YOUR_KEY" \
-F "file=@paper.docx" \
-F 'settings={"refs":true,"figures":"number","tables":"number","equations":"number","sections":"number","doi":true}'Code Examples#
curl
curl -X POST https://api.kernit.org/hyperlink \
-H "Authorization: Bearer sk_kernit_live_YOUR_KEY" \
-F "file=@paper.docx" \
-F 'settings={"refs":true,"figures":"number","tables":"number","equations":"number","sections":"number","doi":true}'JavaScript
const apiKey = 'sk_kernit_live_YOUR_KEY';
const form = new FormData();
form.append('file', fileInput.files[0]);
form.append('settings', "{\"refs\":true,\"figures\":\"number\",\"tables\":\"number\",\"equations\":\"number\",\"sections\":\"number\",\"doi\":true,\"crossref\":true}");
const response = await fetch('https://api.kernit.org/hyperlink', {
method: 'POST',
headers: { Authorization: 'Bearer ' + apiKey },
body: form
});
const text = await response.text();Python
import requests
api_key = 'sk_kernit_live_YOUR_KEY'
with open('paper.docx', 'rb') as docx:
response = requests.post(
'https://api.kernit.org/hyperlink',
headers={'Authorization': f'Bearer {api_key}'},
files={'file': ('paper.docx', docx, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document')},
data={
'settings': "{\"refs\":true,\"figures\":\"number\",\"tables\":\"number\",\"equations\":\"number\",\"sections\":\"number\",\"doi\":true,\"crossref\":true}",
},
timeout=480
)
print(response.status_code)
print(response.text)Try This Endpoint#
Responses#
| Status | Meaning | Schema |
|---|---|---|
200 | Base64 DOCX and link statistics. | ApplyResult |
400 | Invalid request shape, missing file, invalid JSON, or rejected DOCX. | ErrorResponse |
401 | Missing or invalid authorization. | ErrorResponse |
402 | No credits or plan allowance available. | ErrorResponse |
413 | DOCX exceeds the current 25 MB limit. | ErrorResponse |
429 | Per-key or organization request rate limit exceeded. | ErrorResponse |
default | Unexpected KERNIT-side service error. | ErrorResponse |
Error Examples#
400 Invalid request shape, missing file, invalid JSON, or rejected DOCX.
{
"error": "Invalid JSON in form data"
}401 Missing or invalid authorization.
{
"error": "Missing authorization header"
}402 No credits or plan allowance available.
{
"error": "No credits remaining"
}413 DOCX exceeds the current 25 MB limit.
{
"error": "File exceeds 25MB limit"
}Implementation Edge Cases#
| Case | Expected handling |
|---|---|
| Wrong-link risk | Use the one-step route only when the input is predictable. Use scan/resolve/apply when reviewers need to correct targets first. |
| Missing API key | Return 401. Production automation should send Authorization: Bearer sk_kernit_live_... on api.kernit.org. |
| Rate limit exceeded | Return 429 with retry_after when rate limiting is configured. Keep the operation pending until the delay passes. |
| No document allowance | Return 402. This is a billing or plan state, not a request-shape problem. |
When to Use It#
| Use one-step when | Use review flow when |
|---|---|
| Documents are internally generated and predictable. | Documents come from varied authors or journals. |
| Your product has no human review step. | Wrong links must be corrected before output. |
| You only need conservative internal links. | You apply resolver evidence or retarget decisions. |
Was this page useful?Send a lightweight docs feedback event.