Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request GET /api/v2/assets/F-Ihco1txSEhkiRsU4H0/comments 200 { "comments": [ { "id": 1, "message": "Sample comment for tests", "updated_at": "2023-11-27T09:42:40.792Z", "user": { "id": 37, "email": "admin-user-21@example.com", "first_name": null, "last_name": null, "avatar_url": null }, "mentioned_users": [] } ] }
// If :asset_id is not found GET /api/v2/assets/not-found-id/comments 404 { "error": "asset not found" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
comment required |
Comment content Validations:
|
// Successful request POST /api/v2/assets/GFGxVzokYRrLy5pqvSoZ/comments { "comment": "new comment" } 200 { "comment": { "id": 2, "message": "new comment", "updated_at": "2023-11-27T09:42:41.296Z", "user": { "id": 39, "email": "admin-user-23@example.com", "first_name": null, "last_name": null, "avatar_url": null }, "mentioned_users": [] } }
// If :asset_id is not found POST /api/v2/assets/not-found-id/comments { "comment": "new comment" } 404 { "error": "asset not found" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
comment required |
Comment content Validations:
|
// Successful request POST /api/v2/assets/_nAP4srVRn36-h-NkabF/comments/3 { "comment": "new updated comment" } 200 { "comment": { "message": "new updated comment", "id": 3, "updated_at": "2023-11-27T09:42:41.744Z", "user": { "id": 41, "email": "admin-user-25@example.com", "first_name": null, "last_name": null, "avatar_url": null }, "mentioned_users": [] } }
// If :asset_id is not found POST /api/v2/assets/not-found-id/comments/4 { "comment": "new updated comment" } 404 { "error": "asset not found" }
// If :comment_id is not found POST /api/v2/assets/NZSjLmD3evGjFSxAnDH3/comments/not-found-id { "comment": "new updated comment" } 404 { "error": "Couldn't find Comment with 'id'=not-found-id [WHERE \"comments\".\"target_id\" = $1 AND \"comments\".\"target_type\" = $2]" }
// If current user is not a owner of the comment POST /api/v2/assets/2nU5cvV55n8Dggb8A6qG/comments/5 { "comment": "new updated comment" } 403 { "error": "Not allowed to perform this action" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request DELETE /api/v2/assets/jyFeCfaCfuHzE5MRDG6-/comments/6 200 { "ok": "comment deleted" }
// If :asset_id is not found DELETE /api/v2/assets/not-found-id/comments/7 404 { "error": "asset not found" }
// If :comment_id is not found DELETE /api/v2/assets/exNa-QFoFFI9pCKaifJ4/comments/not-found-id 404 { "error": "Couldn't find Comment with 'id'=not-found-id [WHERE \"comments\".\"target_id\" = $1 AND \"comments\".\"target_type\" = $2]" }
// If current user is not a owner of the comment DELETE /api/v2/assets/nlUwQmik222LrU-tzLwE/comments/8 403 { "error": "Not allowed to perform this action" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request GET /api/v2/assets/aNrQZjg-mWXu0zH_j44F/comments/9 200 { "comment": { "id": 9, "message": "Sample comment for tests", "updated_at": "2023-11-27T09:42:43.720Z", "user": { "id": 51, "email": "admin-user-35@example.com", "first_name": null, "last_name": null, "avatar_url": null }, "mentioned_users": [] } }
// If :asset_id is not found GET /api/v2/assets/not-found-id/comments/10 404 { "error": "asset not found" }
// If :comment_id is not found GET /api/v2/assets/cHZtkitg97U8gDluqN9o/comments/not-found-id 404 { "error": "Couldn't find Comment with 'id'=not-found-id [WHERE \"comments\".\"target_id\" = $1 AND \"comments\".\"target_type\" = $2]" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request GET /api/v2/assets/aDI1pAbBd97MtBQgiC97/dag_actions 200 { "dag_actions": [ { "id": 1, "name": "Sample DAG action 1", "description": "Sample DAG action for tests", "category": "Tests" } ] }
// If user does not have 'ACTIONS_VIEW' permission GET /api/v2/assets/xiE7yoEJZc_lqWjIyhTE/dag_actions 403 { "error": "Permission denied. Must have ACTIONS_VIEW permissions." }
// If :asset_id is not found GET /api/v2/assets/not-found-id/dag_actions 404 { "error": "asset not found" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request POST /api/v2/assets/0OprWMsC6dzYzlrkk556/dag_actions/2 200 { "dag_action_run": { "id": 1, "status": "running", "created_at": "2023-11-27T09:42:45.532Z", "dag_action": { "id": 2, "name": "Sample DAG action 2", "description": "Sample DAG action for tests", "category": "Tests" }, "dag_action_run_messages": [ { "id": 1, "message": "Set in queue...", "created_at": "2023-11-27T09:42:45.549Z" } ] } }
// If user does not have 'ACTIONS_START' permission POST /api/v2/assets/UwBqbRTvYH0vx0Kirqgz/dag_actions/3 403 { "error": "Permission denied. Must have ACTIONS_START permissions." }
// If :dag_action_id is not found POST /api/v2/assets/_X3j_onTt0BWsw0yPvow/dag_actions/not-found-id 404 { "error": "Couldn't find DagAction with 'id'=not-found-id" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request GET /api/v2/assets/fvihM9798awLO9Cvekqv/dag_action_runs 200 { "dag_action_runs": [ { "id": 2, "status": "running", "created_at": "2023-11-27T09:42:46.368Z", "dag_action": { "id": 4, "name": "Sample DAG action 4", "description": "Sample DAG action for tests", "category": "Tests" }, "dag_action_run_messages": [ { "id": 2, "message": "Set in queue...", "created_at": "2023-11-27T09:42:46.371Z" } ] } ] }
// If user does not have 'ACTIONS_VIEW' permission GET /api/v2/assets/wMoeQTrSHVd41AD0cmoj/dag_action_runs 403 { "error": "Permission denied. Must have ACTIONS_VIEW permissions." }
// If :asset_id is not found GET /api/v2/assets/not-found-id/dag_action_runs 404 { "error": "asset not found" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Successful request GET /api/v2/assets/7UhQGdm3p9MJHRBI9Ohu/history/0 200 { "history": { "results": [ { "id": 29, "user_id": 66, "event_type": "ASSET_ADDED", "created_at": "2023-11-27T09:42:47.222Z", "updated_at": "2023-11-27T09:42:47.222Z", "event_targets": [ { "target_type": "Asset", "target": { "id": 25, "elasticsearch_id": "7UhQGdm3p9MJHRBI9Ohu", "title": "Sample Asset" } } ] } ], "next_cursor": null } }
// If :asset_id is not found GET /api/v2/assets/-1/history/0 404 { "error": "asset not found" }
// Unprocessable entity GET /api/v2/assets/mrEAiYVZZIUxLmeHBSFl/history/test 422 { "error": "Invalid parameter 'cursor' value \"test\": Invalid cursor" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
// Failed request GET /api/v2/assets/not-found-id 404 { "error": "asset not found" }
// Successful request GET /api/v2/assets/rSkRlq2Aiw4wJvjvlqSm 200 { "asset": { "id": "rSkRlq2Aiw4wJvjvlqSm", "external_id": null, "parent_id": null, "project_id": null, "owner": "admin-user-51@example.com", "title": "Sample Asset", "description": "Sample asset description.", "category": "test asset category", "tags": [ "test", "tag" ], "ai_tags": [], "status": "open", "media_type": "placeholder", "original_filename": null, "drop_folder_id": null, "md5_sum": null, "created_date": "2023-11-27T09:42:48.046Z", "modification_date": "2023-11-27T09:42:48.046Z", "deleted": null } }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
// Failed request GET /api/v2/assets/not-found-id/collections 404 { "error": "asset not found" }
// Succesful request GET /api/v2/assets/ZghYk6IBrpJnJhzkEthH/collections 200 { "collections": [ { "id": "JbuS2l7wxuXQWOx1qfw0", "title": "Sample Collection", "description": "Sample collection description.", "category": null, "tags": [], "owner": "admin-user-87@example.com", "media_type": "collection", "isPublic": false, "created_date": "2023-11-27T09:42:57.716Z", "modification_date": "2023-11-27T09:42:57.716Z", "original_title": "Sample Collection" } ] }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
include_locations optional |
Whether to include media locations in the response Validations:
|
// Successful request GET /api/v2/assets/psSgRfiBJKpoHQ5TGdTY/media 200 { "media": [] }
// Successful request with media locations included GET /api/v2/assets/CutFw4bl1vvTle5lOuq_/media?include_locations=true 200 { "media": [] }
// Failed request GET /api/v2/assets/not_found_id/media 404 { "error": "asset not found" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
filename required |
Filename on disk Validations:
|
// Successful request GET /api/v2/assets/cwac7S8WlJJTEuGrvMf_/media/1/download_url?filename=test.png 200 { "url": null }
// Failed request GET /api/v2/assets/not_found_id/media/2/download_url?filename=test.png 404 { "error": "asset not found" }
// Failed request GET /api/v2/assets/43o3Z9rt6A97RQQIIhRt/media/not_found_id/download_url?filename=test.png 404 { "error": "Couldn't find Media with 'id'=not_found_id [WHERE \"media\".\"asset_id\" = $1]" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
file_url required |
URL where file is located and can be downloaded by Media Pocket Validations:
|
filename required |
Original filename Validations:
|
// HTTP file URL POST /api/v2/assets/4Z1MJ6s7L1HqPBf7Mol5/media { "file_url": "http://www.example.com/jpgfile.jpg", "filename": "jpgfile.jpg" } 200 { "ok": "ok" }
// HTTPS file URL POST /api/v2/assets/xGZbvO04EXYglsPR1xuL/media { "file_url": "https://www.example.com/jpgfile.jpg", "filename": "jpgfile.jpg" } 200 { "ok": "ok" }
// Invalid file URL POST /api/v2/assets/5f-96poumuaeFIVS0u2F/media { "file_url": "/local/downloads/myfile.jpg", "filename": "myfile.jpg" } 400 { "error": "not a valid HTTP URL" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
title required |
Title Validations:
|
description optional |
Description Validations:
|
category optional |
Category Validations:
|
tags optional |
Tags Validations:
|
media_type optional |
Type. During asset creation, only used for articles. Defaults to placeholder with no media. Validations:
|
external_id optional |
External ID Validations:
|
// Failed request, missing required "title" parameter POST /api/v2/assets { "description": "Sample asset from API V2", "category": "Sample", "tags": [ "sample", "test" ] } 422 { "error": "Missing parameter title" }
// Failed request, invalid media type POST /api/v2/assets { "title": "Sample Asset", "description": "Sample asset from API V2", "category": "Sample", "tags": [ "sample", "test" ], "media_type": "image" } 422 { "error": "Invalid parameter 'media_type' value \"image\": Must be one of: <code>article</code>." }
// Successful request POST /api/v2/assets { "title": "Sample Asset", "description": "Sample asset from API V2", "category": "Sample", "tags": [ "sample", "test" ] } 200 { "asset": { "id": "-vevooaEWuYCnLFQqe2l", "external_id": null, "parent_id": null, "project_id": null, "owner": "admin-user-54@example.com", "title": "Sample Asset", "description": "Sample asset from API V2", "category": "sample", "tags": [ "sample", "test" ], "ai_tags": [], "status": "open", "media_type": "placeholder", "original_filename": null, "drop_folder_id": null, "md5_sum": null, "created_date": "2023-11-27T09:42:48.538Z", "modification_date": "2023-11-27T09:42:48.538Z", "deleted": null } }
// External ID has already been taken POST /api/v2/assets { "title": "Sample Asset", "external_id": "already_used_id" } 400 { "error": "External id has already been taken" }
// Successful request, valid media type POST /api/v2/assets { "title": "Sample Asset", "description": "Sample asset from API V2", "category": "Sample", "tags": [ "sample", "test" ], "media_type": "article" } 200 { "asset": { "id": "dbZ_vHeiERRUyDRlX_FY", "external_id": null, "parent_id": null, "project_id": null, "owner": "admin-user-56@example.com", "title": "Sample Asset", "description": "Sample asset from API V2", "category": "sample", "tags": [ "sample", "test" ], "ai_tags": [], "status": "open", "media_type": "article", "original_filename": null, "drop_folder_id": null, "md5_sum": null, "created_date": "2023-11-27T09:42:49.160Z", "modification_date": "2023-11-27T09:42:49.282Z", "deleted": null } }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
title optional |
Title Validations:
|
description optional |
Description Validations:
|
category optional |
Category Validations:
|
tags optional |
Tags Validations:
|
external_id optional |
External ID Validations:
|
// Successful request PUT /api/v2/assets/jzEVblfJWkxEReLG4EiF { "title": "Modified Sample Asset", "description": "Modified Description", "category": "Modified Category", "tags": [ "Test", "Tags", "Here" ], "external_id": "modified_external_id" } 200 { "asset": { "id": "jzEVblfJWkxEReLG4EiF", "external_id": "modified_external_id", "parent_id": null, "project_id": null, "owner": "admin-user-57@example.com", "title": "Modified Sample Asset", "description": "Modified Description", "category": "modified category", "tags": [ "test", "tags", "here" ], "ai_tags": [], "status": "open", "media_type": "placeholder", "original_filename": null, "drop_folder_id": null, "md5_sum": null, "created_date": "2023-11-27T09:42:49.451Z", "modification_date": "2023-11-27T09:42:49.584Z", "deleted": null } }
// Invalid request PUT /api/v2/assets/not-found-id { "title": "Modified Sample Asset", "description": "Modified Description", "category": "Modified Category", "tags": [ "Test", "Tags", "Here" ], "external_id": "modified_external_id" } 404 { "error": "asset not found" }
// With invalid parameters PUT /api/v2/assets/0X24pu3thwNyOx4l9FNY { "title": "Testing too long title: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" } 400 { "error": "Title is too long (maximum is 255 characters)" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Failed request POST /api/v2/assets/not-found-id/trash_bin 404 { "error": "asset not found" }
// Successful request POST /api/v2/assets/83q3xVMeDRY-1zxunRUg/trash_bin 200 { "ok": "ok" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
// Failed request POST /api/v2/assets/not-found-id/restore 404 { "error": "asset not found" }
// Trying to restore asset that is not in trash bin POST /api/v2/assets/p2fs58BoVHMY_SEOUEwt/restore 400 { "error": "Can not restore Assets that is not in trash bin" }
// Successful request POST /api/v2/assets/wCqlpqcXTsYOh-zsDplS/restore 200 { "ok": "ok" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
asset_id required |
Asset ID Validations:
|
// Failed request DELETE /api/v2/assets/not-found-id 404 { "error": "asset not found" }
// Successful request DELETE /api/v2/assets/5qbOnvM7S_nRPO4Wb0rp 200 { "ok": "ok" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
Param name | Description |
---|---|
to_project_id required |
Project ID Validations:
|
// Invalid request POST /api/v2/assets/not-found-id/assign 404 { "error": "asset not found" }
// Successful request POST /api/v2/assets/dHrlNNyL0cHpzyT5jizP/assign { "to_project_id": "mJebz2r3ck0CTGIExPa4" } 200 { "ok": "ok" }
// Invalid to_project_id parameter POST /api/v2/assets/YKZ6LQkrjzquPGFmMeoc/assign { "to_project_id": "not-found-id" } 200 { "error": "Project not found." }
// Trying to assign asset to self POST /api/v2/assets/vjYKTYScv7HjFEEx0RHI/assign { "to_project_id": "vjYKTYScv7HjFEEx0RHI" } 200 { "error": "Project not found." }
// Asset already has a parent project POST /api/v2/assets/YPWWsCVNnlaJnbnSYkKU/assign { "to_project_id": "a7rYTJIBVOpM1qBIdlO6" } 200 { "ok": "ok" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Invalid request DELETE /api/v2/assets/not-found-id/unassign 404 { "error": "asset not found" }
// Asset has no parent project DELETE /api/v2/assets/jyusFI1jcOiXBam_SYJr/unassign 200 { "error": "jyusFI1jcOiXBam_SYJr does not have a parent project" }
// Successful request DELETE /api/v2/assets/KclN4HNrWbHu9yXRpRyN/unassign 200 { "ok": "ok" }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |
Header name | Description |
---|---|
Content-Type required |
application/json |
X-API-KEY required |
YOUR_API_KEY |
// Failed request DELETE /api/v2/assets/not-found-id/media 404 { "error": "asset not found" }
// Succesful request DELETE /api/v2/assets/faNNZ8yt0dUA8dWA0-WW/media 200 { "asset": { "id": "faNNZ8yt0dUA8dWA0-WW", "external_id": null, "parent_id": null, "project_id": null, "owner": "admin-user-85@example.com", "title": "Sample Asset", "description": "Sample asset description.", "category": "test asset category", "tags": [ "test", "tag" ], "ai_tags": [ "test", "tag" ], "status": "open", "media_type": "image", "original_filename": "test_filename.jpg", "drop_folder_id": null, "md5_sum": "c6779ec2960296ed9a04f08d67f64422", "created_date": "2023-11-27T09:42:57.051Z", "modification_date": "2023-11-27T09:42:57.142Z", "deleted": null }, "errors": { "error": "No media found on this asset.", "status": 400 } }
Code | Description |
---|---|
401 | Unauthorized |
404 | Not found |
500 | Internal Server Error |
422 | Missing parameters |