Create a File
POST/v2/files
Create a File
Request
- multipart/form-data
Body
required
Indicates the file you want to upload.
Use this parameter to reference a file stored at a specific location. This must be the URL that points to an image file.
Responses
- 201
- 400
- 422
- 500
Created
- application/json
- Schema
- Example (from schema)
- default
Schema
data File
The unique identifier for this file.
The type represents the object being returned.
The name of the file.
The mime type of the file.
The size of the file. Required when uploading files.
DEPRECATED Whether the file public or not. Required when uploading files.
meta FileMeta
timestamps object
The date and time the file was created.
The date and time the file was created.
dimensions object
The file dimensions.
The width of the file.
The height of the file.
links object
Links are used to allow you to move between requests.
Single entities use a self parameter with a link to that specific resource.
link object
The publicly available URL for this file.
The publicly available URL for this file.
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "file",
"file_name": "file_name.jpg",
"mime_type": "image/jpeg",
"file_size": 36000,
"public": true,
"meta": {
"timestamps": {
"created_at": "2023-10-11T13:02:25.293Z"
},
"dimensions": {
"width": 1800,
"height": 1000
}
},
"links": {
"self": "https://https://euwest.api.elasticpath.com//v2/files/ddc28c74-a7df-46be-b262-8fa69a6e7d52"
},
"link": {
"href": "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png"
}
}
}
{
"data": {
"type": "file",
"id": "f8cf26b3-6d38-4275-937a-624a83994702",
"link": {
"href": "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png"
},
"file_name": "f6669358-85db-4367-9cde-1deb77acb5f4.png",
"mime_type": "image/png",
"file_size": 110041,
"meta": {
"dimensions": {
"width": 1000,
"height": 1000
},
"timestamps": {
"created_at": "2018-03-13T13:45:21.673Z"
}
},
"links": {
"self": "https://useast.api.elasticpath.com/v2/files/f8cf26b3-6d38-4275-937a-624a83994702"
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- file-location-invalid
- file-not-uploaded
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "file_location invalid",
"status": 422,
"detail": "@/path/to/file.jpg is not a valid URL"
}
]
}
{
"errors": [
{
"title": "Validation Failed",
"status": 400,
"detail": "You have not supplied a file to store"
}
]
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- file-location-invalid
- file-not-uploaded
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "file_location invalid",
"status": 422,
"detail": "@/path/to/file.jpg is not a valid URL"
}
]
}
{
"errors": [
{
"title": "Validation Failed",
"status": 400,
"detail": "You have not supplied a file to store"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors Error[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
Internal request ID.
Additional supporting meta data for the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"status": 500,
"title": "Internal Server Error",
"detail": "There was an internal server error, you can report with your request id.",
"request_id": "635da56d-75a1-43cd-b696-7ab119756b3a"
}
]
}