Back to Manual

Micropub API

Pika supports the Micropub standard, an open API for creating and updating posts from third-party apps. You can use any Micropub client to publish to your Pika blog.

Contents


Setup

Go to Settings and click App tokens. Create a new token and copy it immediately — it won't be shown again. Your token has create, update, and media scopes.

Your Micropub endpoint is:

https://pika.page/micropub

Your media endpoint is:

https://pika.page/micropub/media

If you're using a Micropub client that supports endpoint discovery, it will find these automatically from your blog's HTML.


Using iA Writer

iA Writer has built-in Micropub support on Mac, iPhone, and iPad.

  1. Create an app token in Settings → App tokens on Pika and copy it to your clipboard.
  2. In iA Writer, go to Settings → Publishing → + button → Micropub.
  3. Choose Enter Token Manually.
  4. Enter your blog's URL (e.g. https://you.pika.page) and paste your app token. iA Writer will discover your Micropub endpoint automatically.
  5. While still in iA Writer's Publishing settings, with Micropub selected, click Options… and set the format to Markdown.

To send your post to Pika as a draft, right-click a document in your library and choose Publish → New Draft on Micropub.


Using Drafts

You can publish a draft post from Drafts by installing the Post to Pika action.

  1. Create an app token in Settings → App tokens on Pika and copy it to your clipboard.
  2. Install the Post to Pika action as a basic action in Drafts.
  3. Run the action for the first time. When prompted, paste your app token when asked for the authentication token.

Write your post in Drafts, then run the Post to Pika action to send it as a draft to Pika. If the first line of your draft is a Markdown heading (#, ##, ###, etc) it is used as the post title.


Authentication

All requests require a Bearer token in the Authorization header:

Authorization: Bearer YOUR_TOKEN

Creating posts

Send a POST request to /micropub. Content supports Markdown.

Form-encoded

POST /micropub
Content-Type: application/x-www-form-urlencoded

content=Hello+**world**&name=My+Post&category[]=ruby&category[]=rails

JSON

POST /micropub
Content-Type: application/json

{
  "type": ["h-entry"],
  "properties": {
    "content": ["Hello **world**"],
    "name": ["My Post"],
    "category": ["ruby", "rails"]
  }
}

To create a draft post add the following property:

"post-status": ["draft"]

On success the response is 201 Created with a Location header pointing to the new post. If the user has a custom domain, the Location header will point to the post on that custom domain. The Location header will point to the Pika dashboard page to edit the post when saving a draft post.


Updating posts

Updates use JSON and require the post URL. Three operations are supported:

Replace properties

{
  "action": "update",
  "url": "https://you.pika.page/posts/my-post",
  "replace": {
    "content": ["Updated **content**"],
    "name": ["New Title"],
    "category": ["new-tag"],
    "post-status": ["draft"]
  }
}

Add values

{
  "action": "update",
  "url": "https://you.pika.page/posts/my-post",
  "add": {
    "category": ["another-tag"]
  }
}

Remove values

{
  "action": "update",
  "url": "https://you.pika.page/posts/my-post",
  "delete": {
    "category": ["remove-this-tag"]
  }
}

On success the response is 200 OK with the updated post properties.


Querying

Use GET requests to query your Micropub endpoint.

Server configuration

GET /micropub?q=config

Returns the media endpoint URL.

Post source

GET /micropub?q=source&url=https://you.pika.page/posts/my-post

Returns the post's properties including content, title, tags, status, and published date.


Media endpoint

Upload images before creating a post. The media endpoint accepts JPEG, PNG, and GIF files.

POST /micropub/media
Content-Type: multipart/form-data

file=@photo.jpg

On success the response is 201 Created with a Location header containing the image URL. Use this URL in your post content or as a photo property:

{
  "type": ["h-entry"],
  "properties": {
    "content": ["Check out this photo"],
    "photo": ["https://pika.page/micropub/media/abc123"]
  }
}

Photos can also include alt text:

"photo": [{"value": "https://pika.page/micropub/media/abc123", "alt": "A sunset"}]

Uploaded images that have not been been used in Pika as part of a draft or published post are automatically cleaned up after a few months.

Media endpoint flow for client developers
1. UPLOAD IMAGES

   For each image in the post, upload it first:

   POST /micropub/media
   Authorization: Bearer <token>
   Content-Type: multipart/form-data
   file=@photo.jpg

   Response:
   201 Created
   Location: https://pika.page/micropub/media/abc123


2. USE THE URLS IN YOUR POST

   Reference the returned URLs in your markdown
   content or as photo properties:

   POST /micropub
   Authorization: Bearer <token>
   Content-Type: application/json

   {
     "properties": {
       "content": ["![My cat](https://pika.page/micropub/media/abc123)"],
       "name": ["Post With Photos"]
     }
   }

   Response:
   201 Created
   Location: <post URL>

   Pika recognizes its own media URLs and efficiently
   uses the original upload — no re-downloading.

3. PREVIEWING UPLOADS

   GET /micropub/media/abc123 requires the same
   Bearer token. Use this to preview uploads in
   your client before submitting the post.

Supported properties

content
Post body in Markdown. Images in content are automatically processed and stored by Pika.
name
Post title. Omit for a titleless post.
category
Tags. Pass as an array for multiple tags. Supports add and remove on update.
post-status
draft or published. Defaults to published.
published
Publish date as an ISO 8601 datetime (e.g. 2025-06-15T10:30:00Z).
photo
One or more image URLs to append to the post. Supports alt text via the object format.

Error responses

Errors follow the Micropub spec format:

{"error": "invalid_request", "error_description": "Missing content."}
401 Unauthorized
Missing or invalid token.
403 Forbidden
Token does not have the required scope.
400 Bad Request
Missing required fields or unsupported action.
404 Not Found
Post not found (on update or query).
429 Too Many Requests
Rate limit exceeded. Wait a minute and try again.

Rate limits

The Micropub API is rate-limited. If you receive a 429 Too Many Requests response, wait a minute and retry your request.