6.3. Uploading image data

PUT /v2/images/{image_id}/file

Upload a binary image file to an image record created, according to Creating image records.

Before you can store binary image data, you must meet the following preconditions:

  • The image must exist.
  • You must set the disk and container formats in the image.
  • The image status must be queued.
  • Your image storage quota must be sufficient.
  • The size of the data that you want to store must not exceed the size that the OpenStack Image service allows.

After the operation completes, the image status will change to active.

Source: https://docs.openstack.org/api-ref/image/v2/index.html?expanded=#upload-binary-image-data

6.3.1. Request

Name In Type Description
Content-type header string The media type descriptor for the request body. Use application/octet-stream
X-Image-Meta-Store (Optional) header string A store identifier to upload or import image data. Should only be included when making a request to a cloud that supports multiple backing stores. Use the store discovery call to determine an appropriate store identifier. Simply omit this header to use the default store. (Since Image API v2.8)
image_id path string The UUID of the image. Example

Set the Content-Type request header to application/octet-stream.

# curl -ks -X PUT -H 'Content-Type: application/octet-stream' -H 'X-Auth-Token: gAAAAA<...>' \
--data-binary @cirros2.qcow2 \

6.3.2. Response Status codes Success

Code Reason
204 - No Content The server has fulfilled the request. Error

Code Reason
400 - Bad Request Some content in the request was invalid.
401 - Unauthorized User must authenticate before making a request.
403 - Forbidden Policy does not allow current user to do this operation.
404 - Not Found The requested resource could not be found.
409 - Conflict This operation conflicted with another operation on this resource.
410 - Gone The access request to the target resource is no longer available.
413 - Request Entity Too Large The request is larger than the server is willing or able to process.
415 - Unsupported Media Type The request entity has a media type which the server or resource does not support.
503 - Service Unavailable Service is not available. This is mostly caused by service configuration errors which prevents the service from successful start up.