anytype.Object
Templates and custom properties
Pass the selected type and template when constructing the object. Properties linked to that type are available by their API key or by their normalized display name:
obj = Object("Test", type=quote_type, template=template)
obj.date = "02/06/2026"
obj.people = [person]
created = space.create_object(obj)
date must be the key of a date property. people must be the key of an objects
property; it accepts object instances or object IDs. A multi-select property instead
accepts tag names or Tag instances.
Properties selected from the space can also be assigned explicitly:
properties = {prop.key: prop for prop in space.get_properties()}
properties["date"].value = "02/06/2026"
properties["people"].value = [person]
obj.properties["date"] = properties["date"]
obj.properties["people"] = properties["people"]
Bases: APIWrapper
Represents an object within a specific space, allowing creation and manipulation of its properties. The object can be customized with various attributes such as name, icon, body, description, and more. This class provides methods to export objects and add different content types to the object body, such as titles, text, code blocks, checkboxes, and bullet points.
IMPORTANT
Certain properties of an object, such as:
DOIin a collection of articles;Release Yearin albums;Genrein music collections;Authorin book collections;Publication Datein documents;Ratingin review-based objects;Tagsin categorized objects;
are accessible through the class properties. For example, if an object is created with a Type (e.g., anytype.Type) that includes a DOI property, the DOI URL can be set during the object creation using Object.doi.
You can also provide a Template for this object.
Note that these property names are derived from the corresponding name in the Anytype GUI. They are all lowercase with spaces replaced by underscores. For instance, a property called Release Year in the Anytype GUI will be accessed as release_year in the object, and a property called Publication Date will be accessed as publication_date.
Source code in anytype/object.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
add_bullet(text)
Adds a bullet point to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to be added as a bullet point. |
required |
add_checkbox(text, checked=False)
Adds a checkbox to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to be added next to the checkbox. |
required |
checked
|
bool
|
Whether the checkbox is checked. Default is False. |
False
|
Source code in anytype/object.py
add_codeblock(code, language='')
Adds a code block to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
The code to be added. |
required |
language
|
str
|
The programming language of the code block. Default is an empty string. |
''
|
Source code in anytype/object.py
add_image(image_url, alt='', title='')
Adds an image to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_url
|
str
|
The URL of the image. |
required |
alt
|
str
|
The alternative text for the image. Default is an empty string. |
''
|
title
|
str
|
The title of the image. Default is an empty string. |
''
|
Source code in anytype/object.py
add_text(text)
Adds plain text to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to be added. |
required |
add_title1(text)
Adds a level 1 title to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to be added as a level 1 title. |
required |
add_title2(text)
Adds a level 2 title to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to be added as a level 2 title. |
required |
add_title3(text)
Adds a level 3 title to the object's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text to be added as a level 3 title. |
required |
add_type(type)
Adds a type for an Object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
Type
|
Type from the space retrieved using |
required |