Skip to contentDevelopersPrezly website
Stories

Import Story from HTML

Convert HTML, resolve media, and create a story. Inspect diagnostics as well as the HTTP status.

Personal token scopes: stories:write. Your account must also have access to the requested data. Authentication

Read the guide

POST
/stories/import-from-html

Convert HTML into Prezly content format and create a story from it, in one call.

Conversion, image upload and creation happen together, so no images are uploaded unless a story is actually created.

Everything in Convert HTML to Content applies to the conversion itself. Two differences:

  • Images are uploaded. Each image referenced in the HTML — whether a URL or an inlined data: URI — is fetched, uploaded and embedded. An image that cannot be uploaded leaves its placeholder behind and is reported in diagnostics rather than failing the import. Only public http(s) targets are fetched, and SVG is refused.
  • A title is required. title and subtitle are not ordinary story fields here: Prezly keeps them inside the content document, so they are used to build the header when the HTML has no leading heading of its own. With neither, the request is rejected rather than creating a story that could never be published.

Other story fields (newsroom, culture, custom_slug, visibility, …) behave exactly as they do on Create Story.

From a URL (beta)

Send url instead of html to import the story published at that address. This is in beta and can get things wrong: review every story imported this way before publishing it. See Importing from a URL.

Personal access tokens: stories:write. Every listed scope is required; the token owner's permissions, feature availability and newsroom access still apply.

Authorization

API_key
headerAuthorizationBearer <token>

Bearer authentication using an integration API key, or a personal access token only where the operation explicitly supports it. Every listed personal-token scope is required; owner permissions and newsroom access still apply.

Request Body

application/json
  1. body

The story fields both HTML-import endpoints pass straight through to the ordinary create and update paths, where they are validated exactly as they are there.

title and subtitle are deliberately not here: format_version 6 keeps them inside the content document, so the import endpoints hand them to the converter rather than to the story. Neither is content — that is what the import produces.

seo_settings is not here either, because creating a story does not take it. It is on the import-into-an-existing-story endpoint, which does.

html*string

The HTML to import. Maximum 20MB.

url?string

Beta. The address of a published story, instead of html. The story is picked out of the page automatically and can miss content or include parts of the page that are not the story, so review the result before publishing. See Importing from a URL. Send either html or url, not both; nodes cannot be combined with url.

Formaturi
title?string

Story title, used when the HTML has no leading heading to promote. Required unless the HTML carries its own <h1>.

subtitle?string
nodes?array<>

Rich nodes that cannot be recovered from HTML. See Convert HTML to Content.

on_duplicate?string

Only with a url (beta), and update needs newsroom. When this URL has already been imported into the newsroom: refuse answers 409 url.already_imported; update replaces that story's content instead (its slug and newsroom stay) and answers 200.

Default"refuse"
Value in"refuse""update"
newsroom?|||

Newsroom numeric ID or UUID, either directly or in a single-key object.

custom_slug?string

The story's URL slug. Left as it is when not sent.

culture?LocaleCode

Language code (ISO 639-1 or ISO 639-2), with optional script designator (ISO 15924) and optional region code (ISO 3166-1).

Match[a-z]{2,3}(_[A-Z][a-z]{3})?(_[A-Z]{2})?
Length2 <= length
visibility?string
Value in"public""embargo""private""confidential"
published_at?string
Formatdate-time
categories?array<integer>

Category ids. Fractions are refused, so this is an integer list.

tags?array<string>
preview_image?

Object containing info about an uploaded image.

See Images and Files on how to handle images.

social_image?

Object containing info about an uploaded image.

See Images and Files on how to handle images.

social_text?string

Response Body

Only with on_duplicate: update, when the URL had already been imported into the newsroom: that story was updated. Same body as 201, with a url.already_imported info diagnostic.

Example Request
curl -X POST 'https://api.prezly.com/v2/stories/import-from-html' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
Empty