Add an asset
POST https://manage.kontent.ai/v2/projects/:environment_id/assets
Use a file reference to link an existing binary file to a new asset. You can also create assets by upserting (PUT /assets/external-id/<external_id>).
Each binary file can be referenced only by a single asset.
Request Body
{"file_reference"=>{"value"=>"<Error: Too many levels of nesting to fake this schema>"}, "descriptions"=>[{"value"=>"<Error: Too many levels of nesting to fake this schema>"}, {"value"=>"<Error: Too many levels of nesting to fake this schema>"}], "elements"=>[{"value"=>"<Error: Too many levels of nesting to fake this schema>"}, {"value"=>"<Error: Too many levels of nesting to fake this schema>"}], "external_id"=>"<string>", "file_name"=>"<string>", "folder"=>{"id"=>{"value"=>"<Error: Too many levels of nesting to fake this schema>"}, "external_id"=>{"value"=>"<Error: Too many levels of nesting to fake this schema>"}, "codename"=>{"value"=>"<Error: Too many levels of nesting to fake this schema>"}}, "collection"=>{"reference"=>{"value"=>"<Error: Too many levels of nesting to fake this schema>"}}, "id"=>"<uuid>", "codename"=>"<string>", "image_height"=>"<integer,null-int32>", "image_width"=>"<integer,null-int32>", "last_modified"=>"<dateTime>", "size"=>"<integer>", "title"=>"<string,null>", "type"=>"<string>", "url"=>"<string>"}
HEADERS
| Key | Datatype | Required | Description |
|---|---|---|---|
Content-Type | string | ||
Accept | string |
RESPONSES
status: Created
{"id":"fcbb12e6-66a3-4672-85d9-d502d16b8d9c","file_name":"file_name.jpeg","title":"Description of what the file contains","size":148636,"type":"image/jpeg","url":"https://assets-us-01.kc-usercontent.com/8d20758c-d74c-4f59-ae04-ee928c0816b7/adf26cd2-1acb-403f-9d1e-6d04e46c39f1/file_name.png","image_width":1280,"image_height":548,"file_reference":{"id":"fcbb12e6-66a3-4672-85d9-d502d16b8d9c","type":"internal"},"folder":{"id":"8fe4ff47-0ca8-449d-bc63-c280efee44ea"},"descriptions":[{"language":{"id":"00000000-0000-0000-0000-000000000000"},"description":"The asset's alt text in the default language describing what the file or image shows."}],"elements":[{"element":{"id":"c7c3b834-2222-5677-89c4-b46f04489109"},"value":[{"id":"53a5eecb-f295-59b4-a07d-19655b6ad860"},{"id":"3f367e4f-75b7-4b48-be3b-1136bbaf1f53"}]}],"external_id":"custom-asset-identifier","last_modified":"2017-09-12T08:29:36.1645977Z"}