GET /api/v2/assets/:asset_id
Get asset

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

GET /api/v2/assets/yo2uT3wBW4fR4Me2gHzn
200
{
  "asset": {
    "id": "yo2uT3wBW4fR4Me2gHzn",
    "external_id": null,
    "project_id": null,
    "parent_asset_id": null,
    "owner": "support@mediapocket.io",
    "description": "Sample asset description.",
    "title": "Sample Asset",
    "category": "",
    "tags": [
      "Test",
      "Tag"
    ],
    "media_type": "placeholder",
    "modification_date": "2021-10-05T09:00:09Z",
    "created_date": "2021-10-05T09:00:08Z",
    "status": "open",
    "original_filename": null,
    "deleted": false
  }
}
GET /api/v2/assets/not-found-id
404
{
  "error": "asset not found"
}
GET /api/v2/assets/0I2uT3wBW4fR4Me2onyI
404
{
  "error": "asset not found"
}

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

GET /api/v2/assets/:asset_id/media
Get asset media and download URLs

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

POST /api/v2/assets/:asset_id/media
Add media to asset

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

POST /api/v2/assets/342uT3wBW4fR4Me2-HzL/media
{
  "file_url": "http://www.example.com/jpgfile.jpg",
  "filename": "jpgfile.jpg"
}
200
{
  "ok": "ok"
}
POST /api/v2/assets/4I2uT3wBW4fR4Me2_HzP/media
{
  "file_url": "https://www.example.com/jpgfile.jpg",
  "filename": "jpgfile.jpg"
}
200
{
  "ok": "ok"
}
POST /api/v2/assets/4Y2vT3wBW4fR4Me2AHzQ/media
{
  "file_url": "/local/downloads/myfile.jpg",
  "filename": "myfile.jpg"
}
200
{
  "error": "not a valid url"
}

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

file_url
required

URL where file is located and can be downloaded by Media Pocket

Validations:

  • Must be a String

filename
required

Original filename

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

POST /api/v2/assets
Create asset

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

POST /api/v2/assets
{
  "title": "Sample Asset",
  "description": "Sample asset from API V2",
  "category": "Sample",
  "tags": [
    "sample",
    "test"
  ]
}
200
{
  "asset": {
    "id": "zY2uT3wBW4fR4Me2jHyH",
    "external_id": null,
    "project_id": null,
    "parent_asset_id": null,
    "owner": "support@mediapocket.io",
    "description": "Sample asset from API V2",
    "title": "Sample Asset",
    "category": "Sample",
    "tags": [
      "sample",
      "test"
    ],
    "media_type": "placeholder",
    "modification_date": "2021-10-05T09:00:12Z",
    "created_date": "2021-10-05T09:00:11Z",
    "status": "open",
    "original_filename": null,
    "deleted": false
  }
}
POST /api/v2/assets
{
  "title": "Sample Live Asset",
  "description": "Sample live asset from API V2",
  "category": "Sample",
  "media_type": "live",
  "tags": [
    "sample",
    "test"
  ]
}
200
{
  "asset": {
    "id": "3o2uT3wBW4fR4Me28nz3",
    "external_id": null,
    "project_id": null,
    "parent_asset_id": null,
    "owner": "support@mediapocket.io",
    "description": "Sample live asset from API V2",
    "title": "Sample Live Asset",
    "category": "Sample",
    "tags": [
      "sample",
      "test"
    ],
    "media_type": "live",
    "modification_date": "2021-10-05T09:00:39Z",
    "created_date": "2021-10-05T09:00:38Z",
    "status": "open",
    "original_filename": null,
    "deleted": false
  }
}

Params

Param name Description
title
required

Title

Validations:

  • Must be a String

description
optional

Description

Validations:

  • Must be a String

category
optional

Category

Validations:

  • Must be a String

tags
optional

Tags

Validations:

  • Must be an array of String

media_type
optional

Media type

Validations:

  • Must be one of: live.

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

PUT /api/v2/assets/:asset_id
Update asset

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

PUT /api/v2/assets/zo2uT3wBW4fR4Me2kXwE
{
  "title": "Modified Sample Asset",
  "description": "Modified Description",
  "category": "Modified Category",
  "tags": [
    "Test",
    "Tags",
    "Here"
  ],
  "external_id": "modified_external_id"
}
200
{
  "asset": {
    "id": "zo2uT3wBW4fR4Me2kXwE",
    "external_id": "modified_external_id",
    "project_id": null,
    "parent_asset_id": null,
    "owner": "support@mediapocket.io",
    "description": "Modified Description",
    "title": "Modified Sample Asset",
    "category": "Modified Category",
    "tags": [
      "Test",
      "Tags",
      "Here"
    ],
    "media_type": "placeholder",
    "modification_date": "2021-10-05T09:00:14Z",
    "created_date": "2021-10-05T09:00:12Z",
    "status": "open",
    "original_filename": null,
    "deleted": false
  },
  "errors": {}
}

Params

Param name Description
title
optional

Title

Validations:

  • Must be a String

description
optional

Description

Validations:

  • Must be a String

category
optional

Category

Validations:

  • Must be a String

tags
optional

Tags

Validations:

  • Must be an array of String

external_id
optional

External ID

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

POST /api/v2/assets/:asset_id/trashbin
Move asset to trash bin from where it will be deleted after 14 days

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

POST /api/v2/assets/0Y2uT3wBW4fR4Me2qnxe/trash_bin
200
{
  "ok": "ok"
}
POST /api/v2/assets/not-found-id/trash_bin
404
{
  "error": "asset not found"
}

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

POST /api/v2/assets/:asset_id/restore
Restores asset from trash bin

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

POST /api/v2/assets/042uT3wBW4fR4Me2tnyK/restore
200
{
  "ok": "ok"
}
POST /api/v2/assets/not-found-id/restore
404
{
  "error": "asset not found"
}
POST /api/v2/assets/not-found-id/restore
404
{
  "error": "asset not found"
}

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

DELETE /api/v2/assets/:asset_id
Permanently delete asset

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

DELETE /api/v2/assets/z42uT3wBW4fR4Me2mXxA
200
{
  "ok": "ok"
}
DELETE /api/v2/assets/0I2uT3wBW4fR4Me2onyI
200
{
  "ok": "ok"
}

Params

Param name Description
asset_id
required

Asset ID

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

POST /api/v2/assets/:asset_id/assign
Assign asset to project

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

POST /api/v2/assets/not-found-id/assign
404
{
  "error": "asset not found"
}
POST /api/v2/assets/1o2uT3wBW4fR4Me2wnzj/assign
{
  "to_project_id": "not-found-id"
}
200
{
  "error": "project with id: not-found-id not found"
}
POST /api/v2/assets/142uT3wBW4fR4Me2x3xi/assign
{
  "to_project_id": "2I2uT3wBW4fR4Me2ynzh"
}
200
{
  "ok": "ok"
}

Params

Param name Description
to_project_id
required

Project ID

Validations:

  • Must be a String

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY

DELETE /api/v2/assets/:asset_id/unassign
Unassign asset from project

Errors

Code Description
401 Unauthorized
500 Internal Server Error
422 Missing parameters

Examples

DELETE /api/v2/assets/not-found-id/unassign
404
{
  "error": "asset not found"
}
DELETE /api/v2/assets/2o2uT3wBW4fR4Me22nxS/unassign
200
{
  "error": "asset doesn't belong to any project"
}
DELETE /api/v2/assets/242uT3wBW4fR4Me23nzM/unassign
200
{
  "ok": "ok"
}

Headers

Header name Description
Content-Type
required
application/json
X-API-KEY
required
YOUR_API_KEY