# Subscribe to a webhook event

**POST** `/dpm/webhooks/v1/subscriptions`

Base URL: `https://api.pre.globalgetnet.com`

Subscribe to receive webhooks. Select the event, authentication type and url to subscribe to an event.

## Authorization

- PROD (oauth2)
- PRE (oauth2)
- SBX (oauth2)

## Header parameters

- `x-seller-id` (string, required)
  Seller identifier (UUID). An empty or absent value results in an authentication error.

## Body

Content type: `application/json`

- `seller_id` (string)
  Seller identification, returned in responses. Send the seller identifier via the x-seller-id header instead.
- `callback_url` (string<uri>, required)
  URL to callback when the event is triggered
- `event` ("APPROVED_TRANSACTIONS" | "REJECTED_TRANSACTIONS" | "REFUNDED_TRANSACTIONS" | "CANCELLED_TRANSACTIONS" | "CAPTURED_TRANSACTIONS" | "CARD_UPDATE" | "CARD_UPDATED_TRANSACTIONS" | "PENDING_TRANSACTIONS" | "PIX_UPDATED_TRANSACTIONS" | "BOLETO_UPDATED_TRANSACTIONS" | "BOLETO_PAID_TRANSACTIONS" | "PROCESSING_TRANSACTIONS" | "FAILED_TRANSACTIONS" | "EXPIRED_TRANSACTIONS" | "AUTHORIZED_TRANSACTIONS" | "PIX_APPROVED_TRANSACTIONS" | "PIX_CANCELED_TRANSACTIONS" | "BOLETO_REGISTERED_TRANSACTIONS" | "CHARGEBACK_NEEDS_RESPONSE" | "REVERSED_TRANSACTIONS", required)
  Webhook event
- `authentication_type` ("user_credentials" | "oauth", required)
  Authentication type
- `authentication_data` (object)
  - `user` (string, required)
    Basic authentication user
  - `password` (string, required)
    Basic authentication password
- `subscription_id` (string<uuid>)
  Subscription identifier. Assigned by the server — do not send in requests.

Example:

```json
{
  "seller_id": "06f256c8-1bbf-42bf-93b4-ce2041bfb87e",
  "callback_url": "https://myserver.com/send/callback/here",
  "event": "APPROVED_TRANSACTIONS",
  "authentication_type": "user_credentials",
  "authentication_data": {
    "user": "1cb9c739-8452-4436-816b-a833960b7680",
    "password": "78ce12f6-665b-4354-8eaf-f0384413aaa8"
  },
  "subscription_id": "c2829224-45c1-4024-ac2c-4be8c42ff993"
}
```

## Responses

### 201

Subscription created

- `status` (string)
- `message` (string)
- `data` (object)
  - `seller_id` (string)
    Seller identification, returned in responses. Send the seller identifier via the x-seller-id header instead.
  - `callback_url` (string<uri>, required)
    URL to callback when the event is triggered
  - `event` ("APPROVED_TRANSACTIONS" | "REJECTED_TRANSACTIONS" | "REFUNDED_TRANSACTIONS" | "CANCELLED_TRANSACTIONS" | "CAPTURED_TRANSACTIONS" | "CARD_UPDATE" | "CARD_UPDATED_TRANSACTIONS" | "PENDING_TRANSACTIONS" | "PIX_UPDATED_TRANSACTIONS" | "BOLETO_UPDATED_TRANSACTIONS" | "BOLETO_PAID_TRANSACTIONS" | "PROCESSING_TRANSACTIONS" | "FAILED_TRANSACTIONS" | "EXPIRED_TRANSACTIONS" | "AUTHORIZED_TRANSACTIONS" | "PIX_APPROVED_TRANSACTIONS" | "PIX_CANCELED_TRANSACTIONS" | "BOLETO_REGISTERED_TRANSACTIONS" | "CHARGEBACK_NEEDS_RESPONSE" | "REVERSED_TRANSACTIONS", required)
    Webhook event
  - `authentication_type` ("user_credentials" | "oauth", required)
    Authentication type
  - `authentication_data` (object)
    - `user` (string, required)
      Basic authentication user
    - `password` (string, required)
      Basic authentication password
  - `subscription_id` (string<uuid>)
    Subscription identifier. Assigned by the server — do not send in requests.

Example:

```json
{
  "status": "success",
  "message": "Operation completed successfully",
  "data": {
    "seller_id": "06f256c8-1bbf-42bf-93b4-ce2041bfb87e",
    "callback_url": "https://myserver.com/send/callback/here",
    "event": "APPROVED_TRANSACTIONS",
    "authentication_type": "user_credentials",
    "authentication_data": {
      "user": "1cb9c739-8452-4436-816b-a833960b7680",
      "password": "78ce12f6-665b-4354-8eaf-f0384413aaa8"
    },
    "subscription_id": "c2829224-45c1-4024-ac2c-4be8c42ff993"
  }
}
```

### 400

Bad request

- `code` (string, required)
  Unique alphanumeric human readable error code
- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors. The object type varies depending on the error context.

Example:

```json
{
  "code": "guid_error",
  "message": "x-seller-id must be a valid guid",
  "details": "[ {\"property\": \"x-seller-id\", \"constraint\":\"guid\"}]"
}
```

### 422

Unprocessable entity

- `code` (string)
  Unique alphanumeric human readable error code
- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors. The object type varies depending on the error context.

Example:

```json
{
  "code": "field_size_error",
  "message": "Size for field [name] must be between 10 and 50",
  "details": [
    {}
  ]
}
```

### 500

Internal server error

- `message` (string, required)
  Brief summary of the reported issue
- `details` (object[])
  Array of errors. The object type varies depending on the error context.

Example:

```json
{
  "message": "Internal Server Error",
  "details": "[]"
}
```