# Parchment API Programmatically manage your collections, pages, and blocks. ## Base URL https://theparchment.app/functions/v1/api ## Authentication All requests require header: x-api-key curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{"action":"list_collections"}' ## Rate Limits - 60 requests/minute per API key - 1000 requests/day per API key - 10KB max content per block ## Actions - list_collections - create_collection - delete_collection - rename_collection - list_pages - create_page - delete_page - rename_page - get_page - append_blocks (adds blocks to END of page — does NOT replace existing) - replace_blocks (deletes all existing blocks, writes new ones in array order — use for full rewrites) - update_blocks (alias for append_blocks — kept for backwards compatibility) - delete_block - delete_group ## Block Types - text - heading1 - heading2 - heading3 - bullet_list - numbered_list - todo (checkbox) - quote - divider - code - group (container block — groups child blocks together; use group_id on child blocks to associate them) ## Nested Lists (indent_level) bullet_list and numbered_list blocks support an indent_level field (integer, 0-4) for nested sub-lists. - Level 0 (default): top-level — rendered as 1, 2, 3 - Level 1: sub-items — rendered as a, b, c - Level 2+: deep sub-items — rendered as i, ii, iii (roman numerals) Example: {"type":"numbered_list","content":"Sub-item","indent_level":1} ## Block Content Format Block content is stored as HTML strings. Use standard HTML tags for formatting: - Bold: <b>bold</b> or <strong>bold</strong> - Italic: <i>italic</i> or <em>italic</em> - Strikethrough: <s>strikethrough</s> or <del>strikethrough</del> - Link: <a href="url">link text</a> - Color: <span style="color: red">colored text</span> ## append_blocks example (adds to end of page) curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{ "action": "append_blocks", "page_id": "<page_id>", "blocks": [ { "type": "heading1", "content": "<span style=\"color: red\">My Red Heading</span>" }, { "type": "text", "content": "First item" } ] }' ## replace_blocks example (rewrites entire page — RECOMMENDED for full page writes) curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{ "action": "replace_blocks", "page_id": "<page_id>", "blocks": [ { "type": "heading1", "content": "My Page Title" }, { "type": "text", "content": "First paragraph." }, { "type": "divider" }, { "type": "text", "content": "Second paragraph." } ] }' NOTE: update_blocks is kept as an alias for append_blocks for backwards compatibility. ## rename_page curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{"action":"rename_page","page_id":"<page_id>","title":"My New Title"}' ## rename_collection curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{"action":"rename_collection","collection_id":"<collection_id>","name":"My Collection"}' ## delete_block curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{"action":"delete_block","page_id":"<page_id>","block_id":"<block_id>"}' ## Group Blocks A group block is a container (like a div) that holds child blocks together. Create a group block first, then append child blocks with group_id set to the group's id. Use delete_group to delete the group and all its children in one operation. ## delete_group curl -X POST https://theparchment.app/functions/v1/api \ -H "Content-Type: application/json" \ -H "x-api-key: pmt_your_key" \ -d '{"action":"delete_group","page_id":"<page_id>","group_block_id":"<group_id>"}' ## Data Export Use list_collections to get all collections, list_pages for each collection, and get_page for each page (which includes all blocks with id, type, content, position).