Skip to content
Aruvi
Esc
↑↓navigate↵open⌘Jpreview
On this page

REST API

Everything the web app does, over HTTP. Scripts sign in with the device flow and use a bearer token.

The REST API lives under /api/v1. Its full reference, generated from the code, is in your own instance at /api/v1/docs, and the OpenAPI document is at /api/v1/openapi.json.

Sign in from a script

Scripts use the OAuth device flow with the built-in public client aruvi-cli.

  1. Ask for a code:

    curl -s https://aruvi.example.com/api/auth/device/code \
      -d client_id=aruvi-cli \
      -d scope="openid offline_access" \
      -d resource=https://aruvi.example.com/api/v1

    The response has a user_code, a verification_uri_complete and a device_code.

  2. Open verification_uri_complete in your browser, check the code matches, and choose Connect.

  3. Swap the device code for tokens. Until you’ve connected, this answers authorization_pending; wait the interval it gives before asking again.

    curl -s https://aruvi.example.com/api/auth/oauth2/token \
      -d grant_type=urn:ietf:params:oauth:grant-type:device_code \
      -d device_code=DEVICE_CODE \
      -d client_id=aruvi-cli

You get an access_token, good for an hour, and a refresh_token to get a new one. The script shows up in Settings → Connected agents, where you can disconnect it.

Use it

curl -s https://aruvi.example.com/api/v1/items/links \
  -H "authorization: Bearer $TOKEN" \
  -H "content-type: application/json" \
  -d '{"url": "https://example.com/article", "tags": ["reading"]}'
curl -s "https://aruvi.example.com/api/v1/items?q=tag:reading" -H "authorization: Bearer $TOKEN"

Export

Endpoint Returns
GET /api/v1/export/markdown A .tar.gz of Markdown files with frontmatter, in your folders, next to the original images and PDFs. The trash is left out.
GET /api/v1/export/bookmarks A bookmarks HTML file any browser can import.

Was this page helpful?