URL commands
DEVONthink To Go allows you to execute certain actions by opening links, URLs, that begin with ‘x-devonthink:’ or ‘x-devonthinktogo:’ instead of, e.g., the well-known ‘http:’. You can add these links to other apps, e.g., OmniFocus, or even paste or type them into the address bar of Safari. Instead of opening a web page they activate DEVONthink To Go and make it do something.
For Workflow.app and other automation tools, DEVONthink To Go supports the x-callback-url protocol. Many commands listed below can be used either directly or as x-callback-url command.
The URL commands for DEVONthink To Go look like follows:
x-devonthink://[?<par1=value1>[&<par2=value2>…]] x-devonthink://x-callback-url/[?<par1=value1>[&<par2=value2>…]]
All parameter values have to be percent-encoded. If you are manually building URL commands, you can use online tools like urlencode.org to encode the values.
Adding data
clip: Opens the New Document Assistant, pre-filled with the provided data.
createbookmark: Creates a new bookmark.
createdocument: Creates a new document from UTI and file data.
creategroup: Creates a new group.
createhtml: Creates a new HTML document.
createimage: Creates a new image.
createmarkdown: Creates a new Markdown document.
createtext: Creates a new plain text document.
createwebarchive: Creates a new webarchive.
import-clipboard: Imports data from the pasteboard to the global inbox.
Depending on the command you have to provide additional data via parameters:
destination: The UUID of a group or database where the item shall be created.
title: The title of the item to be created.
comment: A comment to be added to the item.
location: The URL linking to the content, e.g., the URL of the website for the bookmark or the image.
source: Base64-encoded file data for createimage and createdocument, raw HTML data for createhtml.
text: The text content for text documents.
uti: The UTI for the document (only used for and required by createdocument).
Note: If the ‘destination’ parameter is not specified the item is created in the global inbox. You can find the UUID of a group by getting its item link and cutting the UUID out of the URL (the long alphanumeric string after ‘x-devonthink-item://’).
Examples:
x-devonthink://createbookmark?location=http%3A%2F%2Fwww.nytimes.com&title=New%20York%20Timesx-devonthink://x-callback-url/createtext?title=Robotic+manta+ray&text=Building+a+robot+is+easy.+But…
Retrieving data
You can retrieve metadata about a document or even the document content (up to 10 MB in size) using the following two commands. As they deliver raw data they only work when called with the x-callback-url protocol variant.
item: Retrieves selected metadata of a document as JSON object.
content: Retrieves the content of a document as base64-encoded data.
Both commands take one parameter:
uuid: The UUID of the document, e.g., derived from an item link (see above).
The data is sent back in the following parameters of the x-success URL:
text: The base64-encoded document data or the metadata as JSON object.
input: ‘text’ (for Workflow.app).
uti: The UTI of the document (‘content’ command only).
Example:
x-devonthink://x-callback-url/item?uuid=50EA48F6-D528-4512-B528-B9F24F46185F&x-success=workflow%3A%2F%2Frun-workflow%3Fname%3DItemMetadata
Searching
Search your databases.
search: Search DEVONthink To Go and show or retrieve the results.
The command takes the following parameters:
query: The query to use for the search.
scope: The UUID of the database or group to search. Optional; if not set DEVONthink To Go searches all databases.
When called in the regular form the command navigates to either the database or group given as scope or to the global inbox. It then shows the search field, sets the scope button, and enters your query.
When called in the x-callback-url form DEVONthink To Go executes the search and sends the results back:
text: The results as JSON array of objects.
input: ‘text’ (for Workflow.app).
Examples:
x-devonthink://search?query=devonthink+AND+%28mac+OR+ios%29 x-devonthink://x-callback-url/search?query=devonthink+AND+%28mac+OR+ios%29&scope=50EA48F6-D528-4512-B528-B9F24F46185F&x-success=workflow%3A%2F%2Frun-workflow%3Fname%3DSearchResults