---
title: "Subscribe a webhook"
method: POST
path: "/hooks"
tags: ["Webhooks"]
---

# Subscribe a webhook

`POST /hooks`

## Request

- Base URL: `https://api.dynapictures.com`
- URL: `https://api.dynapictures.com/hooks`
- Auth: HTTP bearer

Sends a POST to `targetUrl` each time an image is generated from the template.

## Request body

- HookRequest
  - `targetUrl` string, uri, required: The URL that receives the notifications.
  - `eventType` 'NEW_IMAGE', required: The event to subscribe to.
  - `templateId` string, required: The template to watch.

## Response `200`

The webhook.

- Hook
  - `uid` string, required: The ID of the webhook.
  - `eventType` 'NEW_IMAGE', required: The subscribed event.
  - `targetUrl` string, uri, required: The URL that receives the notifications.
  - `designUid` string: The watched template.
  - `dateCreated` string, date-time: When the webhook was created.

## Other responses

- `400`: The request is invalid. `message` says why.
- `401`: The API key is missing or wrong.
- `403`: The plan limit is reached, the trial has expired, or the key has no access to this resource.

---

[API](https://skmtc.dev/dynapictures/apis/dynapictures-api.md) - [All operations](https://skmtc.dev/dynapictures/apis/dynapictures-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dynapictures/apis/dynapictures-api/revisions/a9820777cfb3?raw)
