API Reference
strapi_client
ActiveDocument
pydantic-model
Bases: BaseModel
Experimental ORM class for Strapi document.
Fields:
-
id(int | None) -
document_id(str | None) -
created_at(datetime | None) -
updated_at(datetime | None) -
published_at(datetime | None)
Source code in src/strapi_client/models/active_document.py
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 | |
get_document
async
classmethod
get_document(client, document_id, populate_all=True)
Get document by document id.
Source code in src/strapi_client/models/active_document.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
get_documents
async
classmethod
get_documents(
client,
populate_all=True,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=0,
page=None,
limit=25,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/active_document.py
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 | |
create_document
async
create_document(client)
Create new document from object.
Source code in src/strapi_client/models/active_document.py
93 94 95 96 | |
update_document
async
update_document(client)
Update document fields from object.
Source code in src/strapi_client/models/active_document.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
delete_document
async
delete_document(client)
Delete document attached to object.
Source code in src/strapi_client/models/active_document.py
115 116 117 118 119 | |
refresh
async
refresh(client, populate_all=True)
Refresh object with latest data from Strapi including relations.
Source code in src/strapi_client/models/active_document.py
128 129 130 131 132 133 134 135 136 137 | |
upsert_document
async
upsert_document(client)
Create document or update fields.
Source code in src/strapi_client/models/active_document.py
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 | |
BaseComponent
pydantic-model
Bases: BasePopulatable
Strapi component.
Source code in src/strapi_client/models/base_component.py
4 5 | |
BaseDocument
pydantic-model
Bases: BasePopulatable
Strapi document with standard fields.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime)
Source code in src/strapi_client/models/base_document.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
LocalizedSmartDocument
pydantic-model
Bases: SmartDocument
SmartDocument for Strapi content types with internationalization enabled.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime) -
locale(str)
Source code in src/strapi_client/models/localized_smart_document.py
6 7 8 9 10 11 12 | |
get_document
async
classmethod
get_document(client, document_id, locale=None)
Get document by document id.
Source code in src/strapi_client/models/smart_document.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
get_documents
async
classmethod
get_documents(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=None,
page=None,
limit=100,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/smart_document.py
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 | |
get_documents_with_meta
async
classmethod
get_documents_with_meta(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=None,
page=None,
limit=100,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/smart_document.py
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 | |
get_first_document
async
classmethod
get_first_document(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
)
First documents if available.
Source code in src/strapi_client/models/smart_document.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
create_document
async
classmethod
create_document(client, data, locale=None)
Create a new document.
Source code in src/strapi_client/models/smart_document.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
model_dump_data
model_dump_data(
exclude_managed_fields=False, json_mode=False
)
Create a dictionary representation of the document.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/strapi_client/models/smart_document.py
179 180 181 182 183 184 185 186 187 188 189 190 191 | |
update_document
async
update_document(
client,
data,
lazy_mode=False,
do_not_compare_fields=None,
)
Update existing document.
Source code in src/strapi_client/models/smart_document.py
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 | |
lazy_update_document
async
lazy_update_document(
client, data, do_not_compare_fields=None
)
Lazy update existing document fields without record synchronization.
Source code in src/strapi_client/models/smart_document.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
update_relations
async
update_relations(
client,
field,
relations=None,
connect=None,
disconnect=None,
)
Update field relations.
Source code in src/strapi_client/models/smart_document.py
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 | |
refresh_document
async
refresh_document(client)
Refresh the document with the latest data from Strapi.
Source code in src/strapi_client/models/smart_document.py
274 275 276 277 278 279 280 281 282 283 284 285 286 | |
delete_document
async
delete_document(client)
Delete the document.
Source code in src/strapi_client/models/smart_document.py
288 289 290 291 292 293 294 | |
upload_file
async
upload_file(client, file, field)
Upload a file to the document's field.
Source code in src/strapi_client/models/smart_document.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
MediaImageDocument
pydantic-model
Bases: BaseDocument
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime) -
name(str) -
alternative_text(str | None) -
caption(str | None) -
width(int | None) -
height(int | None) -
formats(MediaImageFormats | None) -
hash(str) -
ext(str) -
mime(str) -
size(float) -
url(str) -
preview_url(str | None) -
provider(str) -
provider_metadata(dict[str, Any] | None)
Source code in src/strapi_client/models/media_image_document.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
size
pydantic-field
size
Size in kilobytes
SingleSmartDocument
pydantic-model
Bases: BaseDocument
Fully automated ORM class for single Strapi document.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime)
Source code in src/strapi_client/models/single_smart_document.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
get_document
async
classmethod
get_document(client)
Get single document by single api id.
Source code in src/strapi_client/models/single_smart_document.py
20 21 22 23 24 25 26 27 | |
SmartDocument
pydantic-model
Bases: BaseDocument
Fully automated ORM class for Strapi documents.
Fields:
-
id(int) -
document_id(str) -
created_at(datetime) -
updated_at(datetime) -
published_at(datetime)
Source code in src/strapi_client/models/smart_document.py
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 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
get_document
async
classmethod
get_document(client, document_id, locale=None)
Get document by document id.
Source code in src/strapi_client/models/smart_document.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
get_documents
async
classmethod
get_documents(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=None,
page=None,
limit=100,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/smart_document.py
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 | |
get_documents_with_meta
async
classmethod
get_documents_with_meta(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
start=None,
page=None,
limit=100,
with_count=True,
)
Get list of documents.
Source code in src/strapi_client/models/smart_document.py
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 | |
get_first_document
async
classmethod
get_first_document(
client,
sort=None,
filters=None,
publication_state=None,
locale=None,
)
First documents if available.
Source code in src/strapi_client/models/smart_document.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
create_document
async
classmethod
create_document(client, data, locale=None)
Create a new document.
Source code in src/strapi_client/models/smart_document.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
model_dump_data
model_dump_data(
exclude_managed_fields=False, json_mode=False
)
Create a dictionary representation of the document.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/strapi_client/models/smart_document.py
179 180 181 182 183 184 185 186 187 188 189 190 191 | |
update_document
async
update_document(
client,
data,
lazy_mode=False,
do_not_compare_fields=None,
)
Update existing document.
Source code in src/strapi_client/models/smart_document.py
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 | |
lazy_update_document
async
lazy_update_document(
client, data, do_not_compare_fields=None
)
Lazy update existing document fields without record synchronization.
Source code in src/strapi_client/models/smart_document.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
update_relations
async
update_relations(
client,
field,
relations=None,
connect=None,
disconnect=None,
)
Update field relations.
Source code in src/strapi_client/models/smart_document.py
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 | |
refresh_document
async
refresh_document(client)
Refresh the document with the latest data from Strapi.
Source code in src/strapi_client/models/smart_document.py
274 275 276 277 278 279 280 281 282 283 284 285 286 | |
delete_document
async
delete_document(client)
Delete the document.
Source code in src/strapi_client/models/smart_document.py
288 289 290 291 292 293 294 | |
upload_file
async
upload_file(client, file, field)
Upload a file to the document's field.
Source code in src/strapi_client/models/smart_document.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
StrapiClient
Bases: StrapiClientBase
REST API client for Strapi.
Source code in src/strapi_client/strapi_client.py
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 278 279 280 281 282 283 284 285 286 287 288 | |
authorize
authorize(identifier, password)
Get auth token using identifier and password.
Source code in src/strapi_client/strapi_client.py
47 48 49 50 51 52 53 54 55 56 | |
get_single_document
get_single_document(single_api_id, locale=None)
Get document of single type.
Source code in src/strapi_client/strapi_client.py
58 59 60 61 | |
get_document
get_document(
plural_api_id,
document_id,
populate=None,
fields=None,
locale=None,
)
Get document by document id.
Source code in src/strapi_client/strapi_client.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
get_documents
get_documents(
plural_api_id,
sort=None,
filters=None,
populate=None,
fields=None,
publication_state=None,
locale=None,
start=None,
page=None,
batch_size=25,
with_count=True,
)
Get list of documents. By default, operates in batch mode to get all documents automatically.
Source code in src/strapi_client/strapi_client.py
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 | |
create_or_update_single_document
create_or_update_single_document(
single_api_id, data, locale=None
)
Create or update single type document.
Source code in src/strapi_client/strapi_client.py
124 125 126 127 128 129 130 131 132 133 | |
create_document
create_document(plural_api_id, data, locale=None)
Create new document.
Source code in src/strapi_client/strapi_client.py
135 136 137 138 139 140 141 142 143 144 145 146 147 | |
update_document
update_document(
plural_api_id, document_id, data, locale=None
)
Update document fields.
Source code in src/strapi_client/strapi_client.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
delete_single_document
delete_single_document(single_api_id, locale=None)
Delete single type document.
Source code in src/strapi_client/strapi_client.py
164 165 166 | |
delete_document
delete_document(plural_api_id, document_id, locale=None)
Delete document by document id.
Source code in src/strapi_client/strapi_client.py
168 169 170 | |
send_get_request
send_get_request(route, params=None, use_auth=True)
Send GET request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
172 173 174 175 176 177 178 179 180 181 182 183 | |
send_put_request
send_put_request(
route, body=None, params=None, use_auth=True
)
Send PUT request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
185 186 187 188 189 190 191 192 193 194 195 196 197 | |
send_post_request
send_post_request(
route,
json=None,
params=None,
data=None,
files=None,
use_auth=True,
)
Send POST request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
send_delete_request
send_delete_request(route, params=None, use_auth=True)
Send DELETE request to custom endpoint.
Source code in src/strapi_client/strapi_client.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
upload_files
upload_files(
files,
content_type_id=None,
document_id=None,
field=None,
)
Upload a list of files.
Source code in src/strapi_client/strapi_client.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
upload_file
upload_file(
file, content_type_id=None, document_id=None, field=None
)
Upload a list of files.
Source code in src/strapi_client/strapi_client.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
get_uploaded_files
get_uploaded_files(filters=None)
Get uploaded files.
Source code in src/strapi_client/strapi_client.py
275 276 277 278 | |
check_health
check_health()
Check if Strapi API is available.
Source code in src/strapi_client/strapi_client.py
280 281 282 283 284 285 286 287 288 | |
StrapiClientAsync
Bases: StrapiClientBase
Async REST API client for Strapi.
Source code in src/strapi_client/strapi_client_async.py
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 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
authorize
async
authorize(identifier, password)
Get auth token using identifier and password.
Source code in src/strapi_client/strapi_client_async.py
47 48 49 50 51 52 53 54 55 56 | |
get_single_document
async
get_single_document(single_api_id, locale=None)
Get document of single type.
Source code in src/strapi_client/strapi_client_async.py
58 59 60 61 | |
get_document
async
get_document(
plural_api_id,
document_id,
populate=None,
fields=None,
locale=None,
)
Get document by document id.
Source code in src/strapi_client/strapi_client_async.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
get_documents
async
get_documents(
plural_api_id,
sort=None,
filters=None,
populate=None,
fields=None,
publication_state=None,
locale=None,
start=None,
page=None,
batch_size=25,
with_count=True,
)
Get list of documents. By default, operates in batch mode to get all documents automatically.
Source code in src/strapi_client/strapi_client_async.py
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 | |
create_or_update_single_document
async
create_or_update_single_document(
single_api_id, data, locale=None
)
Create or update single type document.
Source code in src/strapi_client/strapi_client_async.py
124 125 126 127 128 129 130 131 132 133 | |
create_document
async
create_document(plural_api_id, data, locale=None)
Create new document.
Source code in src/strapi_client/strapi_client_async.py
135 136 137 138 139 140 141 142 143 144 145 146 147 | |
update_document
async
update_document(
plural_api_id, document_id, data, locale=None
)
Update document fields.
Source code in src/strapi_client/strapi_client_async.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
delete_single_document
async
delete_single_document(single_api_id, locale=None)
Delete single type document.
Source code in src/strapi_client/strapi_client_async.py
164 165 166 | |
delete_document
async
delete_document(plural_api_id, document_id, locale=None)
Delete document by document id.
Source code in src/strapi_client/strapi_client_async.py
168 169 170 171 172 | |
send_get_request
async
send_get_request(route, params=None, use_auth=True)
Send GET request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
174 175 176 177 178 179 180 181 182 183 184 185 | |
send_put_request
async
send_put_request(
route, body=None, params=None, use_auth=True
)
Send PUT request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
187 188 189 190 191 192 193 194 195 196 197 198 199 | |
send_post_request
async
send_post_request(
route,
json=None,
params=None,
data=None,
files=None,
use_auth=True,
)
Send POST request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
send_delete_request
async
send_delete_request(route, params=None, use_auth=True)
Send DELETE request to custom endpoint.
Source code in src/strapi_client/strapi_client_async.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
upload_files
async
upload_files(
files,
content_type_id=None,
document_id=None,
field=None,
)
Upload a list of files.
Source code in src/strapi_client/strapi_client_async.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
upload_file
async
upload_file(
file, content_type_id=None, document_id=None, field=None
)
Upload a list of files.
Source code in src/strapi_client/strapi_client_async.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
get_uploaded_files
async
get_uploaded_files(filters=None)
Get uploaded files.
Source code in src/strapi_client/strapi_client_async.py
277 278 279 280 | |
check_health
async
check_health()
Check if Strapi API is available.
Source code in src/strapi_client/strapi_client_async.py
282 283 284 285 286 287 288 289 290 | |