Ulysses supports x-callback-urls, allowing other apps to trigger certain actions in Ulysses such as opening existing sheets or creating new sheets, groups or attachments.
(Documentation for Ulysses 2.8 and later)
The used scheme is ulysses://
. Every action can be called through the x-callback-url API using the following format:
ulysses://x-callback-url/[action]?[x-callback parameters]&[parameters]
For more information regarding the URL format, see the official specification.
In the following, all available actions are detailed. Please note that for reasons of clarity, the examples are not yet URL encoded. For instance, all whitespace must be replaced with %20
.
- new-sheet
- new-group
- insert
- attach-note
- update-note
- remove-note
- attach-image
- attach-keywords
- remove-keywords
- set-group-title
- set-sheet-title
- move
- copy
- trash
- get-item
- get-root-items
- read-sheet
- get-quick-look-url
- open
- open-all, open-recent, open-favorites
Creates a new sheet.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
text
The contents that should be inserted to the new sheet. Must be URL-encoded. Contents are imported as Markdown by default.group
Optional. Specifies the group the new sheet should be inserted to. This argument can be set to one of the following values:- A group name (e.g.
My Group
) that will match the first group having the same name, regardless of its position in the group hierarchy. - A path to a particular target group (e.g.
/My Group/My Subgroup
). Any path must begin with a slash. (More…) - A unique identifier of the target group. (More…)
- If no value is given, the sheet is created inside the Inbox.
- A group name (e.g.
format
Optional. Specifies the format of the imported text:markdown
,text
,html
. Defaults to Markdown.index
Optional. The position of the new sheet in its parent group. Use0
to make it the first sheet.
Available since Ulysses 2.8 (API version 2).
Example:
ulysses://x-callback-url/new-sheet?text=My new sheet&index=2
Creates a new group.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
name
The name of the group to be created.parent
Optional. Specifies the parent group the new group should be inserted to. This argument can be set to one of the following values:- A group name (e.g.
My Group
) that will match the first group having the same name, regardless of its position in the group hierarchy. - A path to a particular target group (e.g.
/My Group/My Subgroup
). Any path must begin with a slash. (More…) - A unique identifier of the target group. (More…)
- If no value is given, the group is created inside the top level group.
- A group name (e.g.
index
Optional. The position of the new group in its parent group. Use0
to make it the first group.
Available since Ulysses 2.8 (API version 2).
Example:
ulysses://x-callback-url/new-group?name=My Group&index=3
Inserts or appends text to a sheet.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet the text should be inserted to. (More…)text
The contents that should be inserted to the new sheet. Must be URL-encoded. Contents are imported as Markdown by default.format
Optional. Specifies the format of the imported text:markdown
,text
orhtml
. Defaults to Markdown.position
Optional. Setbegin
orend
in order to insert text at the beginning of a document. If not given, the text is appended.newline
Optional. Specifies how newlines should be inserted to the text: Setprepend
to prepend the inserted text by a newline. Setappend
to append the inserted text with a newline andenclose
to enclose the entire text with newlines.
Example:
ulysses://x-callback-url/insert?id=H8zLAmc1I0njH-0Ql-3YGQ&text=Inserted text
Creates a new note attachment on a sheet.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet the note should be attached to. (More…)text
The contents that should be attached as note to the new sheet. Must be URL-encoded. Contents are imported as Markdown by default.format
Optional. Specifies the format of the imported text:markdown
,text
orhtml
. Defaults to Markdown.
Example:
ulysses://x-callback-url/attach-note?id=H8zLAmc1I0njH-0Ql-3YGQ&text=My new note
Changes an existing note attachment on a sheet. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet where a note should be changed. (More…)index
The position of the note to change. Use0
for the first note,1
for the second note, and so on.text
The new contents of the note. Must be URL-encoded. Contents are imported as Markdown by default.format
Optional. Specifies the format of the imported text:markdown
,text
orhtml
. Defaults to Markdown.
Example:
ulysses://x-callback-url/update-note?id=H8zLAmc1I0njH-0Ql-3YGQ&index=2&text=New note text&access-token=67be78e8b61e946dbc44fd5135ec99bf
Removes a note attachment from a sheet. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet from which a note should be removed. (More…)index
The position of the note to remove. Use0
for the first note,1
for the second note, and so on.
Example:
ulysses://x-callback-url/remove-note?id=H8zLAmc1I0njH-0Ql-3YGQ&index=1&access-token=67be78e8b61e946dbc44fd5135ec99bf
Creates a new image attachment on a sheet.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet the image should be attached to. (More…)image
The image data that should be used. The data must use base64 encoding. Make sure that the base64-encoded data is also URL encoded.format
The format of the provided image (use an image path extension, likepng
,pdf
,jpg
,raw
,gif
).filename
A filename the image format should be detected from. Either the argumentformat
orfilename
must be provided.
Example:
ulysses://x-callback-url/attach-image?id=H8zLAmc1I0njH-0Ql-3YGQ&image=iVBORw0KGgoAAAANSUhEUg…
Adds one or more keywords to a sheet.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet the keywords should be attached to. (More…)keywords
A comma separated list of keywords that should be attached to the sheet.
Example:
ulysses://x-callback-url/attach-keywords?id=H8zLAmc1I0njH-0Ql-3YGQ&keywords=Draft,Important
Removes one or more keywords from a sheet. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet the keywords should be removed from. (More…)keywords
A comma separated list of keywords that should be removed from the sheet.
Example:
ulysses://x-callback-url/remove-keywords?id=H8zLAmc1I0njH-0Ql-3YGQ&keywords=Draft,Important&access-token=67be78e8b61e946dbc44fd5135ec99bf
Changes the title of a group. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
group
The group for which the title should be changed. This argument can be set to one of the following values:- A group name (e.g.
My Group
) that will match the first group having the same name, regardless of its position in the group hierarchy. - A path to a particular target group (e.g.
/My Group/My Subgroup
). Any path must begin with a slash. (More…) - A unique identifier of the target group. (More…)
- A group name (e.g.
title
The new title. Must be URL-encoded.
Example:
ulysses://x-callback-url/set-group-title?group=My Group&title=The new title&access-token=67be78e8b61e946dbc44fd5135ec99bf
Changes the first paragraph of a sheet. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
sheet
The identifier of the sheet for which the title should be changed. (More…)title
The new title. Must be URL-encoded.type
The type of paragraph to use for the title. This argument can be set to one of the following values:heading1
, …,heading6
to use a heading paragraph.comment
to use a comment paragraph.filename
to use a filename paragraph such as@: My Filename
. Only applies to sheets in external folders.
If the sheet has a first paragraph with the requested type, the paragraph contents will be changed (a heading replaces any existing heading). Otherwise, a new paragraph with the requested type and contents will be inserted at the beginning of the sheet.
Example:
ulysses://x-callback-url/set-sheet-title?sheet=hZ7IX2jqKbVmPGlYUXkZjQ&title=The new title&type=heading4&access-token=67be78e8b61e946dbc44fd5135ec99bf
Moves an item (sheet or group) to a target group and/or to a new position. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the item (sheet or group) that should be moved. (More…)targetGroup
Optional ifindex
is set. The group where the item should be moved. This argument can be set to one of the following values:- A group name (e.g.
My Group
) that will match the first group having the same name, regardless of its position in the group hierarchy. - A path to a particular group (e.g.
/My Group/My Subgroup
). Any path must begin with a slash. (More…) - A unique identifier of a sheet or group that should be opened. (More…)
If the parameter is not set, the item will be moved inside of its current parent group.
- A group name (e.g.
index
Optional iftargetGroup
is set. The position of the item in its target group. Use0
to make it the first item.
Example:
ulysses://x-callback-url/move?id=hZ7IX2jqKbVmPGlYUXkZjQ&targetGroup=H8zLAmc1I0njH-0Ql-3YGQ&index=5&access-token=67be78e8b61e946dbc44fd5135ec99bf
Copies an item (sheet or group) to a target group and/or to a new position.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the item (sheet or group) that should be copied. (More…)targetGroup
Optional ifindex
is set. The group where the item should be copied. This argument can be set to one of the following values:- A group name (e.g.
My Group
) that will match the first group having the same name, regardless of its position in the group hierarchy. - A path to a particular group (e.g.
/My Group/My Subgroup
). Any path must begin with a slash. (More…) - A unique identifier of a sheet or group that should be opened. (More…)
If the parameter is not set, the item will be copied inside of its current parent group.
- A group name (e.g.
index
Optional iftargetGroup
is set. The position of the item in its target group. Use0
to make it the first item.
Example:
ulysses://x-callback-url/copy?id=hZ7IX2jqKbVmPGlYUXkZjQ&targetGroup=H8zLAmc1I0njH-0Ql-3YGQ&index=4
Moves an item (sheet or group) to the trash. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the item (sheet or group) that should be moved to the trash. (More…)
Example:
ulysses://x-callback-url/trash?id=hZ7IX2jqKbVmPGlYUXkZjQ&access-token=67be78e8b61e946dbc44fd5135ec99bf
Retrieves information about an item (sheet or group). Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the item (sheet or group) for which to retrieve information. (More…)recursive
Optional. Determines whether the result should include all sub-groups of the group. Only relevant if the item is a group. The allowed values areYES
andNO
. Defaults toYES
.
Results:
The x-success
callback retrieves an argument item
. The value is a URL-encoded JSON object providing information on the requested item. The structure of this value depends on the item type.
Groups:
If the item is a group, then the info object has this format:
title
The title of the group.type
The type of the item. This can begroup
,filter
ortrash
.identifier
The identifier of the group.hasLifetimeIdentifier
Whether the identifier stays the same even if the group is moved or renamed.true
for items that are stored in the sections "iCloud" or "On My Mac" / "On My iPad".false
for items in external folders or Dropbox.containers
The item descriptions for all child groups of this group. Will be empty if the parameterrecursive
was set toNO
.sheets
The item descriptions for all sheets of this group. Will be empty for filters.
Sheets:
If the item is a sheet, then the object has this format:
title
The sheet's title, limited to a length of 256 characters.titleType
The markup type of the title. Will be set toheading1
…heading6
,comment
if the title is a heading or comment. Will be set tofilename
on external folders or Dropbox if the title is the sheet's filename (e.g.@: My Filname
). If no title is given this vlaue is set tonull
.type
The type of the item (alwayssheet
).identifier
The identifier of the sheet.hasLifetimeIdentifier
Whether the identifier stays the same even if the group is moved or renamed.true
for items that are stored in the sections "iCloud" or "On My Mac" / "On My iPad".false
for items in external folders or Dropbox.changeToken
A value that identifies the current verison of the sheet. The change token will have a different value whenever the sheet changes.modificationDate
The timestamp when the sheet was last modified. The timestamp is given as the number of seconds relative to 00:00:00 UTC on 1 January 2001.creationDate
The timestamp when the sheet was last created.
Example:
ulysses://x-callback-url/get-item?id=H8zLAmc1I0njH-0Ql-3YGQ&recursive=NO&access-token=67be78e8b61e946dbc44fd5135ec99bf
Retrieves information about the root sections. Can be used to get a full listing of the entire Ulysses library. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
recursive
Optional. Determines whether the result should be a deep listing of the entire Ulysses library. The allowed values areYES
andNO
. Defaults toYES
.
Results:
The x-success
callback retrieves an argument items
. The value is a URL-encoded JSON array. It contains an info object for each section such as „iCloud”, „On My iPad”, and one for each external folder.
Example:
ulysses://x-callback-url/get-root-items?recursive=NO&access-token=67be78e8b61e946dbc44fd5135ec99bf
Retrieves the contents (text, notes, keywords) of a sheet. Requires authorization.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet that should be read. (More…)text
Optional. Determines whether the full text of the sheet should be included in the result. The allowed values areYES
andNO
. Defaults toNO
.
Results:
The x-success
callback retrieves an argument sheet
. The value is a URL-encoded JSON object. It has the following structure:
title
The sheet's title, limited to a length of 256 characters.titleType
The markup type of the title. Will be set toheading1
…heading6
,comment
if the title is a heading or comment. Will be set tofilename
on external folders or Dropbox if the title is the sheet's filename (e.g.@: My Filname
). If no title is given this vlaue is set tonull
.type
The type of the item (alwayssheet
).changeToken
A value that identifies the current verison of the sheet. The change token will have a different value whenever the sheet changes.modificationDate
The timestamp when the sheet was last modified. The timestamp is given as the number of seconds relative to 00:00:00 UTC on 1 January 2001`.creationDate
The timestamp when the sheet was last created.identifier
The identifier of the sheet.hasLifetimeIdentifier
Whether the identifier stays the same even if the group is moved or renamed.true
for items that are stored in the sections "iCloud" or "On My Mac" / "On My iPad".false
for items in external folders or Dropbox.text
The sheets content encoded as Markdown. This is only available if thetext
parameter was set toYES
.keywords
The keywords of the sheet as an array of strings.notes
The notes of the sheet as an array of strings. All notes are encoded as Markdown.
Example:
ulysses://x-callback-url/read-sheet?id=rQODhTD-dTrwM69Qrsj9cQ&text=YES&access-token=0215c79c391140aab65c3a15ceb61ee1
Gets the QuickLook URL for a sheet. This is the sheet's location on the file system. Only available in Ulysses for Mac.
Available since Ulysses 2.8 (API version 2).
Parameters:
id
The identifier of the sheet for which a QuickLook URL should be generated.
Results:
The x-success
callback retrieves an argument url
. The value is the sheet's URL-encoded file path.
Example:
ulysses://x-callback-url/get-quick-look-url?id=hZ7IX2jqKbVmPGlYUXkZjQ
Opens an item (sheet or group) with a particular identifier in Ulysses.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Parameters:
id
Specifies the item (sheet or group) that should be opened. This argument can be set to one of the following values:- A group name (e.g.
My Group
) that will match the first group having the same name, regardless of its position in the group hierarchy. - A path to a particular group (e.g.
/My Group/My Subgroup
). Any path must begin with a slash. (More…) - A unique identifier of a sheet or group that should be opened. (More…)
- A group name (e.g.
Notes:
You can get a URL for opening sheets and groups directly within Ulysses. On iOS, just swipe on any sheet or group and select the action "More". Then tap the "Share…" action and choose the "Copy URL" activity. A URL for opening your sheet or group has been now placed on your pasteboard. On the Mac, hold ⌥ while right-clicking an item in the Library, or a sheet in the sheets column. Select „Copy Callback URL” from the menu.
Example:
ulysses://x-callback-url/open?id=hZ7IX2jqKbVmPGlYUXkZjQ
Opens the special groups “All”, “Last 7 Days” and “Favorites”.
Available on iOS since Ulysses 2.6 (API version 1), on Mac since Ulysses 2.8 (API version 2).
Retrieves the build number of Ulysses, and the version of Ulysses' X-Callback API.
Available since Ulysses 2.8 (API version 2).
Results:
The x-success
callback retrieves two arguments:
apiVersion
: The version of Ulysses' X-Callback API (e.g.2
). Use this to find out which actions (and parameters) are supported.buildNumber
: The build version number of Ulysses itself (e.g.32193
).
Several callbacks use so-called identifier arguments to specify the sheet or group an operation should be executed on. Identifiers are 22 characters long and are in a URL-safe encoding. E.g. ulysses://x-callback-url/open?id=DCj45UWKr_g15y2vBPwJdQ
will open the item with this identifier.
Identifiers are created internally by Ulysses and allow to reference sheets and groups. If you're using iCloud or a local library, an identifier remains the same, even if the item is edited, renamed or moved around. In external folders, the identifier can change if you move or rename an item. You can get the identifier of a sheet or a group on iOS by following these steps:
- Open the sheet list or library
- Swipe-left on a sheet or group and tap the „More” button
- Select the „Share” action
- Tap the „Copy Identifier” activity
On the Mac, hold ⌥ while right-clicking an item in the Library, or a sheet in the sheets column. Select „Copy Callback Identifier” from the menu.
Afterwards, the identifier of the sheet or group is copied to the pasteboard. The identifier has a URL-safe encoding that can be directly pasted to your x-callback action.
As an alternative to identifiers, the target group of many actions can be also specified by a path of group names. Usually, a path refers to groups inside the sections „iCloud”, „On My iPad” or „On My iPhone”. However, if a path begins with the name of an external folder (e.g. Dropbox), Ulysses will resolve the path within this folder.
A path must begin with a slash character /
. Ulysses will try to match the group names in the path with the original casing first. If the group is not found, Ulysses will fall back to case-insensitive matching.
Example:
/Books/Huckleberry Finn
Matches a group named „Huckleberry Finn” inside the group „Books”./My Dropbox/Reports
If a Dropbox folder „My Dropbox” exists, this path will match the folder „Reports” inside of it.
In addition to action parameters, there are some generic parameters you can provide optionally for any action. Many automation apps provide these arguments automatically:
x-success
URL that should be opened when an action has been successfully completed. If not provided, the user stays in Ulysses. The URL will retrieve at least the following arguments:targetId
The ID of the sheet or group that was either created, modified or revealed by the action.targetURL
A URL that can be used to open the sheet or group that has been created , modified or revealed by the action. Depending on the action, the URL may retrieve more arguments containing additional results.
x-error
URL to be opened if an error occurred. It will retrieve the argumentserrorCode
anderrorMessage
providing further details on the error. Errors will mostly occur, if an identifier cannot be resolved. If not provided, the user stays in Ulysses if an error occurred.
Example:
If a new sheet should be created and Ulysses should return to the calling app, use the following URL (line breaks are for legibility):
ulysses://x-callback-url/new-sheet?
x-success=sourceapp://x-callback-url/success&
group=Lecture Notes
On success, Ulysses will call the following URL to return to the calling app:
sourceapp://x-callback-url/success?
targetId=H8zLAmc1I0njH-0Ql-3YGQ&
targetURL=ulysses://x-callback-url/open?id=H8zLAmc1I0njH-0Ql-3YGQ
To protect the Ulysses library against access from malicious apps, actions that expose content or destructively change require the calling app to be authorized.
Available since Ulysses 2.8 (API version 2).
Authorizing an app My App
consists of these steps:
-
My App
calls Ulysses'authorize
action. The action has a required argumentappname
, which must be set to the name of the calling app. For example:ulysses://x-callback-url/authorize?appname=My App&x-success=myapp://x-callback-url/auth-success
-
Ulysses asks the user to allow or deny
My App
access to the Ulysses library. -
If the user allows access, Ulysses calls the
x-success
callback (in the examplemyapp://x-callback-url/auth-success
) and sets the parameteraccess-token
. If the user denies access, Ulysses calls the providedx-error
callback. -
My App
stores the access token, and passes it to Ulysses when calling actions that require authorization. For example:ulysses://x-callback-url/get-item?id=H8zLAmc1I0njH-0Ql-3YGQ&recursive=NO&access-token=464b33b8ea994f2784dbedca60de0ebf
By default, when an item is affected by an action (e.g. moved), Ulysses reveals it to the user. To prevent this, add the parameter silent-mode=YES
to the URL.
Available since Ulysses 2.8 (API version 2).
On MacOS, an app can also prevent Ulysses switching to foreground. This can be done by setting the option NSWorkspaceLaunchWithoutActivation
when opening the URL using NSWorkspace
.
Every Ulysses version from 2.8 onwards has an API version number, which can be retrieved using the get-version action. The version indicates which actions and parameters can be called.
If you would like to distribute an app that communicates with the X-Callback API of Ulysses, please let it call get-version first, and ensure that it only calls actions that are supported in the Ulysses version installed on the user's system.
The table below shows the API versions supported by different versions of Ulysses:
API Version | Ulysses Version |
---|---|
1 | 2.6, iOS only. |
2 | 2.8 |