Skip to main content

POST/image/create_image_from_file

This method uploads a picture file to eBay Picture Services (EPS) using multipart/form-data.

All images must comply with eBay's picture requirements, such as dimension and file size restrictions. For more information, see Picture policy. The image formats supported are JPG, GIF, PNG, BMP, TIFF, AVIF, HEIC, and WEBP. For more information, see Image requirements.

Note: Animated GIF, and multi-page PNG/TIFF files, are not supported. Any animation effect of supported formats will be lost upon upload.

This call does not have a JSON Request payload but uploads the file as form-data. For example:

 image: "sample_picture.jpg" 
See Samples for information.

Note: You must use a Content-Type header with its value set to 'multipart/form-data'.

When an EPS image is successfully created, the method returns the HTTP Status Code 201 Created. The method also returns the getImage URI in the Location response header.

Important! Make sure to capture the image ID URI returned in the response location header provided in the following format:

https://apim.ebay.com/commerce/media/v1_beta/image/{image_id}

You can capture the entire URI, or just save the {image_id} only. Pass the {image_id} as a path parameter in the getImage method to return the value needed to associate an image to a listing using the Trading and Inventory APIs.

See Managing images for additional details.

Input

Resource URI

POST https://apim.ebay.com/commerce/media/v1_beta/image/create_image_from_file

This method is supported in Sandbox environment. To access the endpoint, just replace the apim.ebay.com root URI with apim.sandbox.ebay.com

URI parameters

This method has no URI parameters.

HTTP request headers

All requests made to eBay REST operations require you to provide the Authorization HTTP header for authentication authorization.

The table below shows additional HTTP request headers that are either required, conditionally required, or strongly recommended for this method. Other standard HTTP request headers- opens rest request components page (not in this table) can also be used, but they are optional.

HeaderTypeDescription
Content-TypestringThis header indicates the format of the request body provided by the client. Its value should be set to multipart/form-data.

For more information, refer to HTTP request headers.

Occurrence: Required

OAuth scope

This request requires an access token created with the authorization code grant flow, using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):

https://api.ebay.com/oauth/api_scope/sell.inventory

See OAuth access tokens for more information.

Request payload

This call does not use a JSON request payload, but uploads files using multipart form data with information about the form data in the key-value pairs. See Create an image from a file for more information.

This call has no payload.

Request fields

This call has no field definitions.

Output

HTTP response headers

See HTTP response headers for details.

HeaderMeaning
LocationThe location response header contains the URI of the newly created image ID in the format:
https://apim.ebay.com/commerce/media/v1_beta/image/{image_id}

Capture this URI to use with the getImage method. See Managing images for more information.

Response payload

Response fields

Output container/fieldTypeDescription
expirationDatestring

The date and time when an unused EPS image will expire and be removed from the EPS server, in Coordinated Universal Time (UTC). As long as an EPS image is being used in an active listing, that image will remain on the EPS server and be accessible.

Occurrence: Always

imageUrlstring

The EPS URL to access the uploaded image. This URL will be used in listing calls to add the image to a listing.

Occurrence: Always

HTTP status codes

This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.

StatusMeaning
201Created
400Bad Request
403Forbidden
500Internal Server Error

Error codes

For more on errors, plus the codes of other common errors, see Handling errors.

CodeDomainCategoryMeaning
190000API_MEDIAAPPLICATIONThere was a problem with an eBay internal system or process. Contact eBay developer support for assistance.
190013API_MEDIAREQUESTUnauthorized access.
190201API_MEDIAREQUESTThe image file size is larger than the limit. Please refer to the documentation.
190202API_MEDIAREQUESTThe supplied image dimensions exceed the limit. Please refer to the documentation.
190203API_MEDIAREQUESTThe supplied image is in a format that is not supported. Please refer to the documentation for a list of supported formats.

Warnings

This call has no warnings.

Samples

New to making API calls? Please see Making a Call.

Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.

Sample 1: Create an image from a file

This call uploads the file using a Content-Type header with its value set to "multipart/form-data". As shown in the Request Body below, the form data is sent as key-value pairs but not as a JSON request payload.

Input

Although there is no JSON request payload, information about the form data is sent as key-value pairs. See Create an image from a file for more information.

POSThttps://apim.ebay.com/commerce/media/v1_beta/image/create_image_from_file

Output

If the call is successful, an HTTP status of 201 Created will be returned alongside the following payload. If the call is successful, the image will be created and the image ID URI will be returned in the Location header.