Scripto docs
View as Markdown

POST /api/articles/import

Create an article from one Medium export HTML file. Parses to Scripto's semantic HTML, preserves the original publish date, and defaults to a draft.

The CLI equivalent is scripto articles import <path>, which reads the export files and calls this route per story (with --dry-run, --publish, and skip flags). See Import from Medium.

Creates an article from one Medium export HTML file — the contents of a single posts/*.html from Medium’s “Download your information” export. Parses it into Scripto’s semantic HTML, preserves the original Medium publish date, and defaults to a draft.

Endpoint

POST https://scripto.codika.io/api/articles/import

Auth

Authorization: Bearer scripto_…

Request

FieldTypeMeaning
htmlstringThe raw contents of one Medium export posts/*.html.
publishbooleanOptional. Publish immediately (ignored for Medium drafts). Default false.
{ "html": "<!doctype html><html>…</html>", "publish": false }

Response (201)

A draft import returns the article row; a published import also returns the public url:

{
  "success": true,
  "data": {
    "article": { "id": "0a1b2c3d-…", "title": "My imported story", "status": "draft", "…": "…" },
    "url": "https://scripto.codika.io/story/my-imported-story"
  }
}

createdAt / publishedAt carry the original Medium date; updatedAt is set to now so the import surfaces at the top of the library list.

Errors

HTTPcodeCausenextAction
400invalid-argumentMissing/empty html.Pass the contents of one Medium export posts/*.html.
400invalid-argumentThe file is a response/comment, not a story.Only import published or drafted stories.
401unauthenticatedMissing or invalid key.
500internalBackend error.

curl

curl -sS -X POST https://scripto.codika.io/api/articles/import \
  -H "Authorization: Bearer $SCRIPTO_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @<(jq -Rs '{html: .}' < ./posts/2024-06-25_My-Story-abc123.html)

Next