# Thumbnails

## Get Thumbnails

`print_mail.thumbnails.get(ThumbnailGetParams**kwargs)  -> ThumbnailGetResponse`

**get** `/print-mail/v1/thumbnails`

Gets the thumbnails of up to 100 resources.

IDs that have no thumbnail yet, and IDs of resources that are deleted,
don't exist, or belong to another organization or mode, are left out of
`data` without an error. Poll until an ID appears with `status` of
`generated`.

This endpoint is limited to 10 requests per minute.

### Parameters

- `resources: Sequence[str]`

  The IDs of the resources to get thumbnails for,
  comma separated (e.g. `resources=template_abc,template_def`). At least 1
  and at most 100. Only template IDs are accepted for now.

### Returns

- `class ThumbnailGetResponse: …`

  - `data: List[Thumbnail]`

    The thumbnails of the requested resources that have one, in no
    particular order.

    - `id: str`

      The ID of the resource this thumbnail is for. Only templates have
      thumbnails for now.

    - `object: Literal["thumbnail"]`

      Always `thumbnail`.

      - `"thumbnail"`

    - `status: Literal["generating", "generated", "failed"]`

      The status of a thumbnail.

      - `"generating"`

      - `"generated"`

      - `"failed"`

    - `medium: Optional[str]`

      A signed URL to an 800 pixel wide JPEG of the resource's first page,
      keeping the page's aspect ratio. The URL expires after 15 minutes, and
      each response returns a fresh one. Absent until the first render has
      been published.

  - `object: Literal["list"]`

    Always `list`.

    - `"list"`

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
thumbnail = client.print_mail.thumbnails.get(
    resources=["string"],
)
print(thumbnail.data)
```

#### Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "template_pxd7wnnD1xY6H6etKNvjb4",
      "object": "thumbnail",
      "status": "generated",
      "medium": "https://pg-prod-bucket-1.s3.amazonaws.com/thumbnails/org_123/test/template_pxd7wnnD1xY6H6etKNvjb4_medium.jpg?X-Amz-Expires=900&X-Amz-Signature=..."
    },
    {
      "id": "template_7mhJUt25TnagyYzy1N81SJ",
      "object": "thumbnail",
      "status": "generating"
    }
  ]
}
```

## Domain Types

### Thumbnail

- `class Thumbnail: …`

  A preview image of the first page of a resource.

  - `id: str`

    The ID of the resource this thumbnail is for. Only templates have
    thumbnails for now.

  - `object: Literal["thumbnail"]`

    Always `thumbnail`.

    - `"thumbnail"`

  - `status: Literal["generating", "generated", "failed"]`

    The status of a thumbnail.

    - `"generating"`

    - `"generated"`

    - `"failed"`

  - `medium: Optional[str]`

    A signed URL to an 800 pixel wide JPEG of the resource's first page,
    keeping the page's aspect ratio. The URL expires after 15 minutes, and
    each response returns a fresh one. Absent until the first render has
    been published.

### Thumbnail Get Response

- `class ThumbnailGetResponse: …`

  - `data: List[Thumbnail]`

    The thumbnails of the requested resources that have one, in no
    particular order.

    - `id: str`

      The ID of the resource this thumbnail is for. Only templates have
      thumbnails for now.

    - `object: Literal["thumbnail"]`

      Always `thumbnail`.

      - `"thumbnail"`

    - `status: Literal["generating", "generated", "failed"]`

      The status of a thumbnail.

      - `"generating"`

      - `"generated"`

      - `"failed"`

    - `medium: Optional[str]`

      A signed URL to an 800 pixel wide JPEG of the resource's first page,
      keeping the page's aspect ratio. The URL expires after 15 minutes, and
      each response returns a fresh one. Absent until the first render has
      been published.

  - `object: Literal["list"]`

    Always `list`.

    - `"list"`
