Images

Upload images.

View as Markdown

Upload image

Uploads a PNG and stores it as a private image for use in a pass. Private images are primarily used for Google Wallet passes, where the mainImage must be hosted by Airship.

This endpoint also supports the Apple Wallet image types thumbnail_image and strip_image, but private images aren’t required for those fields.

Jump to examples ↓

POST /images/projects/{projectId}/{imageNameIdentifier}

Security:

Query parameters:

  • imageType stringREQUIRED

    The image type. This determines the dimensions the image is resized to on upload.

    • mainImage — The main image in the imageModulesData field for Google Wallet passes. The uploaded image is resized to 180×180 pixels. Google only supports private images on imageModulesData. If used on any other Google Wallet pass field, the image is dropped.
    • thumbnail_image — The thumbnail image for an Apple Wallet pass. The uploaded image is resized to 180×180 pixels.
    • strip_image — The strip image for an Apple Wallet pass. The uploaded image is resized to 624×246 pixels.

    For Apple Wallet, you can use the uploaded image in any pass field, but it may not be the correct size if used outside the type specified here.

    Possible values:

    • mainImage
    • thumbnail_image
    • strip_image

Request headers:

  • Api-Revision stringREQUIRED
    The API revision.

    Possible values:

    • 1.2

Path parameters:

  • projectId stringREQUIRED
    The ID of the project.
  • imageNameIdentifier stringREQUIRED
    The unique identifier for the image. Usually consists of an alphanumeric name and a .png extension. Can be used as part of the image URL.

Request body:

The raw binary data of the image to upload. Only PNG is supported.

  • Content-Type: image/png

    Type: string

Responses

  • 200

    Successful upload. Returns metadata about the uploaded image.

    Use the path value returned in this response as the image field’s value in a pass creation or update payload. See Use a private image in a pass in Add private images to wallet passes.

    • Content-Type: application/json

      Metadata about an uploaded image.

  • 400

    Missing or malformed input, invalid image format, or invalid image type.

Examples

Example request

POST /v1/images/projects/12345/test_image.png?imageType=thumbnail_image HTTP/1.1
Authorization: Basic <authorization string>
Content-Type: image/png
Api-Revision: 1.2

[Binary PNG data]

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "path": "passtools_prod/1/images/587ac4e3d188b0fcd4f05038d8814fefd82ac834_test_image.png",
  "source": "uploaded",
  "imageType": "thumbnail_image",
  "width": 180,
  "height": 180
}