Skip to content

Replace a page with Markdown

PUT
/api/v1/pages/{pageId}/markdown
curl --request PUT \
--url https://app.lyra-docs.com/api/v1/pages/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/markdown \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "markdown": "# Launch plan\n\n:::card\nWe launch on the 10th.\n:::\n" }'

Replaces everything on a page with new Markdown, in one change. Comments attached to text that is gone are lost; to change part of a page while others are typing, use POST /api/v1/pages/{pageId}/edits instead. Lyra saves the page as a version first, so it can be put back from the page history.

pageId
required
string format: uuid

The page’s id

Media typeapplication/json
object
markdown
required
string
<= 200000 characters

Example

{
"markdown": "# Launch plan\n\n:::card\nWe launch on the 10th.\n:::\n"
}

OK

Media typeapplication/json

What one edit did.

object
op
required
string
Allowed values: insert replace delete replace_all set_cells insert_row delete_row
blockIds
required

The top-level blocks the edit added or changed

Array<string>
built
required

How many blocks other than plain text the Markdown made, by type, such as {“card”: 3}

object
key
additional properties
integer
warnings
required
Array<object>

A line of Markdown that Lyra read differently from what it looks like you meant, such as a block it does not have or a container that is never closed.

object
line

The line of the Markdown it is about, counting from 1

integer
message
required
string

Example

{
"op": "insert",
"warnings": [
{
"line": 4,
"message": "Lyra has no block named callout, so this line shows as text. Its blocks are card, columns, column, timeline, item, arrow, stat, choice."
}
]
}
X-RateLimit-Limit
integer

How many requests the token can send in a minute

X-RateLimit-Remaining
integer

How many it has left this minute

X-RateLimit-Reset
integer

Seconds until the count starts again

X-Request-Id
string

The id of this request. Send it to support if something goes wrong.

The request does not match the schema: a missing field, a wrong type or a value out of range.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "invalid_request",
"message": "The request is not valid.",
"issues": [
{
"instancePath": "/title",
"message": "Too big: expected string to have <=500 characters"
}
]
}
}

The token is missing, wrong, revoked or expired.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "unauthorized",
"message": "Please sign in."
}
}

The token’s person can see this, but can’t do this to it.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "forbidden",
"message": "You don't have access to do that."
}
}

It doesn’t exist, or the token’s person can’t see it. The code names what, such as page_not_found.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "page_not_found",
"message": "This page doesn't exist or you don't have access to it."
}
}

The page, file or Markdown is too large: page_too_large, file_too_large, or markdown_too_complex for Markdown too long or too deeply nested to read in one go.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "file_too_large",
"message": "Files can be up to 50 MB."
}
}

Too many requests. Each token can send 120 requests a minute. Wait for the seconds in Retry-After.

Media typeapplication/json

What went wrong.

object
error
required
object
code
required

A stable code to check in your code, such as page_not_found

string
message
required

A sentence for people, which can change

string
issues

For invalid_request, each part of the request that was wrong

Array

Example

{
"error": {
"code": "rate_limited",
"message": "Too many requests. Try again in 21 seconds."
}
}
Retry-After
integer

Seconds to wait before sending again