Upload image

POST
/accounts/{accountID}/images
Upload a new PNG, JPEG, or WebP image with optional metadata. Duplicate images return the existing image's metadata with a 409 status. Requests larger than 16MB will be rejected.
curl -X POST "https://api.moov.io/accounts/{accountID}/images" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2027.01.00" \
  -F "image=@/path/to/image" \
  -F 'metadata={}'
mc, _ := moov.NewClient()

var accountID string
image, _ := os.Open("/path/to/image.png")

mc.UploadImage(ctx, accountID, image, &moov.ImageMetadataRequest{
	AltText: moov.PtrOf("Descriptive text of image"),
})
The resource was successfully created.
application/json
Metadata about an uploaded image.
{
  "imageID": "string",
  "publicID": "string",
  "altText": "string",
  "link": "https://api.moov.io/images/qJRAaAwwF5hmfeAFdHjIb",
  "createdOn": "2019-08-24T14:15:22Z",
  "updatedOn": "2019-08-24T14:15:22Z",
  "disabledOn": "2019-08-24T14:15:22Z"
}

x-request-id

string required
A unique identifier used to trace requests.
The server could not understand the request due to invalid syntax.
application/json
{
  "error": "string"
}

x-request-id

string required
A unique identifier used to trace requests.
The request contained missing or expired authentication.

x-request-id

string required
A unique identifier used to trace requests.
The user is not authorized to make the request.

x-request-id

string required
A unique identifier used to trace requests.
The requested resource was not found.

x-request-id

string required
A unique identifier used to trace requests.
A duplicate image was detected. The response body contains the metadata of the existing image.
application/json
Metadata about an uploaded image.
{
  "imageID": "string",
  "publicID": "string",
  "altText": "string",
  "link": "https://api.moov.io/images/qJRAaAwwF5hmfeAFdHjIb",
  "createdOn": "2019-08-24T14:15:22Z",
  "updatedOn": "2019-08-24T14:15:22Z",
  "disabledOn": "2019-08-24T14:15:22Z"
}

x-request-id

string required
A unique identifier used to trace requests.
The request was well-formed, but the contents failed validation. Check the request for missing or invalid fields.
application/json
{
  "image": "string",
  "metadata": {
    "altText": "string"
  }
}

x-request-id

string required
A unique identifier used to trace requests.
Request was refused due to rate limiting.

x-request-id

string required
A unique identifier used to trace requests.
The request failed due to an unexpected error.

x-request-id

string required
A unique identifier used to trace requests.
The request failed because a downstream service failed to respond.

x-request-id

string required
A unique identifier used to trace requests.

Headers

X-Moov-Version

string
Set this header to v2027.01.00 to use the API described in this specification. When omitted, the server defaults to v2024.01.00, the earliest supported version, which may not match the behavior documented here. An unrecognized well-formed version uses the latest supported version that is not newer than the requested version, when one exists. For example, v2026.08.00 uses v2026.07.00. A malformed value, such as 2022, returns a 404 response.
Possible values: v2027.01.00

Path parameters

accountID

string required

Body

multipart/form-data

image

string<binary> required
A PNG, JPEG, or WebP image file to upload.

metadata

object
Optional, json-encoded metadata to associate with the uploaded image.
Request body for creating or updating image metadata.
Show child attributes

metadata

altText

string <=125 characters
Alternative text for the image.

Response

application/json
Metadata about an uploaded image.

createdOn

string<date-time> required

imageID

string required
Unique identifier for a image resource.

link

string<uri> required
A public URL to access the image. An optional size={width}x{height} query parameter can be provided to resize the image.

publicID

string required
The ID used to get an image with the public endpoint.
A unique identifier for an image, used in public image links.

updatedOn

string<date-time> required

altText

string <=125 characters
Alternative text for the image.

disabledOn

string<date-time>