---
title: "Working with sending policies using the API"
canonical: "https://docs.devo.com/space/latest/715030548/Working%20with%20sending%20policies%20using%20the%20API"
format: markdown
---
> Macro (toc)

## Overview

Check the list of available endpoints and methods to work with [sending policies](https://devodocs.atlassian.net/wiki/spaces/latest/pages/95127214) using the Delivery methods API:

|  |  |
| --- | --- |
| **Endpoints and methods** | **Description** |
| [GET]`/policies` <sup>[see below](#)</sup> | Lists the available sending policies in the domain. |
| [GET]`/policies/{id}` <sup>[see below](#)</sup> | Gets a detailed description of a specific sending policy. |
| [POST] `/policies` <sup>[see below](#)</sup> | Creates a new sending policy. |
| [PUT] `/policies` <sup>[see below](#)</sup> | Edits a sending policy. |
| [DELETE] `/policies/{id}` <sup>[see below](#)</sup> | Deletes a sending policy. |

## Endpoints and methods

### > Macro (anchor)

<span style="color: #ff991f">**GET**</span><span style="color: #00b8d9"> </span>`/policies`

Retrieves a list of the sending policies in the domain.

> ⚠️ To perform this request, your Devo user must have at least the Alert configuration (view) permission assigned. Learn more about roles and permissions in this [article](https://docs.devo.com/space/latest/94763681).


### Request

#### Example

Find below a request example in cURL language. This request will retrieve all the email type delivery methods in the domain that corresponds to the given token. Learn how to authorize your request [in this article](https://docs.devo.com/space/latest/127762507).

```
curl -H "standAloneToken:YOUR_TOKEN" -X GET "https://api-us.devo.com/delco/policies"
```

 

### Response

Check the list of available responses:

| **Code** | **Description** |
| --- | --- |
| 200 | Successful response. Available sending policies retrieved.<br>```
[
  {
    "id": 284,
    "name": "default-delivery",
    "isDefault": true,
    "scheduled": {
      "days": [
        "MONDAY",
        "TUESDAY",
        "WEDNESDAY",
        "THURSDAY",
        "FRIDAY",
        "SATURDAY",
        "SUNDAY"
      ],
      "from": "00:00",
      "to": "23:59"
    },
    "deliveryMethods": [
      {
        "id": 331,
        "type": "email",
        "name": "default-email"
      }
    ],
    "antiFloodingPolicy": {
      "id": 267,
      "name": "default AF"
    }
  },
  {
    "id": 1275,
    "name": "mySendingPolicy",
    "isDefault": false,
    "scheduled": {
      "days": [
        "TUESDAY",
        "THURSDAY"
      ],
      "from": "09:30",
      "to": "18:30"
    },
    "deliveryMethods": [
      {
        "id": 331,
        "type": "email",
        "name": "default-email"
      }
    ],
    "antiFloodingPolicy": {
      "id": 267,
      "name": "default AF"
    }
  },
  {
    "id": 467,
    "name": "Workweek - Support Hours",
    "isDefault": false,
    "scheduled": {
      "days": [
        "MONDAY",
        "TUESDAY",
        "WEDNESDAY",
        "THURSDAY",
        "FRIDAY"
      ],
      "from": "08:00",
      "to": "20:00"
    },
    "deliveryMethods": [
      {
        "id": 331,
        "type": "email",
        "name": "default-email"
      }
    ],
    "antiFloodingPolicy": null
  }
]
``` |
| 400 | Request error.<br>```
{
  "code": 400,
  "msg": "string",
  "cid": "string"
}
``` |
| 403 | Authentication required.<br>```
{
  "code": 403,
  "msg": "string",
  "cid": "string"
}
``` |

### > Macro (anchor)

<span style="color: #ff991f">**GET**</span><span style="color: #00b8d9"> </span>`/policies/{id}`

Gets a detailed description of a specific sending policy given its ID.

> ⚠️ To perform this request, your Devo user must have at least the Alert configuration (view) permission assigned. Learn more about roles and permissions in this [article](https://docs.devo.com/space/latest/94763681).


### Request

#### Path parameters

Add the following path parameters as part of the endpoint:

| **Parameter** | **Type** | **Definition** |
| --- | --- | --- |
| `id` <sup><span style="color: #ff5630">required</span></sup> | `integer` | ID of the sending policy you want to retrieve.<br>> ⚠️ **How can I get the ID of a sending policy**
> ⚠️ 
> ⚠️ You can use the <span style="color: #ff991f">**GET**</span><span style="color: #00b8d9">** **</span>`/policies` endpoint to get the IDs of the sending policies defined in your domain. |

#### Example

Find below a request example in cURL language. This request will retrieve all the email type delivery methods in the domain that corresponds to the given token. Learn how to authorize your request [in this article](https://docs.devo.com/space/latest/127762507).

```
curl -H "standAloneToken:YOUR_TOKEN" -X GET "https://api-us.devo.com/delco/policies/123"
```

 

### Response

Check the list of available responses:

| **Code** | **Description** |
| --- | --- |
| 200 | Successful response. Details of the sending policy retrieved.<br>```
{
  "id": 123,
  "name": "default-delivery",
  "isDefault": true,
  "scheduled": {
    "days": [
      "MONDAY",
      "TUESDAY",
      "WEDNESDAY",
      "THURSDAY",
      "FRIDAY",
      "SATURDAY",
      "SUNDAY"
    ],
    "from": "00:00",
    "to": "23:59"
  },
  "deliveryMethods": [
    {
      "id": 331,
      "type": "email",
      "name": "default-email"
    }
  ],
  "antiFloodingPolicy": {
    "id": 267,
    "name": "default AF"
  }
}
``` |
| 400 | Request error.<br>```
{
  "code": 400,
  "msg": "string",
  "cid": "string"
}
``` |
| 403 | Authentication required.<br>```
{
  "code": 403,
  "msg": "string",
  "cid": "string"
}
``` |

### > Macro (anchor)

<span style="color: #36b37e">**POST**</span><span style="color: #00b8d9"> </span>`/policies`

Creates a new sending policy.

> ⚠️ To perform this request, your Devo user must have the Alert configuration (manage) permission assigned. Learn more about roles and permissions in this [article](https://docs.devo.com/space/latest/94763681).


###  Request

#### Request body

You must specify the updates you need to apply to the delivery method in the request body:

| **Parameter** | **Type** | **Definition** |
| --- | --- | --- |
| `name` <sup><span style="color: #ff5630">required</span></sup> | `string` | Name of the new sending policy. |
| `deliveryMethods` <sup><span style="color: #ff5630">required</span></sup> | `object` | Recipient of the alert, which corresponds to a [delivery method](https://devodocs.atlassian.net/wiki/spaces/latest/pages/413859864) created in the domain.<br>Define an object with the following parameters:<br>- `id` (`integer`) - The ID of the desired delivery method. You can use the [GET]`/methods` endpoint to check the ID (more details [here](https://devodocs.atlassian.net/wiki/spaces/latest/pages/413859864)).<br>**Example**<br>```
"deliveryMethods": [
    4668
  ]
```<br>Visit[Create and manage delivery methods](https://docs.devo.com/space/latest/95127270) to know more. |
| `isDefault` | `boolean` | If you set this to `true`, this policy will be automatically assigned to new alerts and predefined alerts that have not actively been assigned a sending policy. |
| `antiFloodingPolicy` |  | Frequency limit established for persistent alerts. You can choose between none, default, or one of your own creation.<br>Visit[Create and manage delivery methods](https://docs.devo.com/space/latest/95127270) to know more. |
| `scheduled` | `object` | Days and hours during which alerts should be distributed. The time zone defined in the delivery method(s) selected is used to calculate times.<br>Define an object with the following parameters:<br>- `days` (`string`) - Enter the weekdays you want the alert to be distributed. Indicate the specific days between brackets `[]`. For example:<br>```
"days": [
    "MONDAY",
    "TUESDAY",
    "WEDNESDAY",
    "THURSDAY",
    "FRIDAY",
    "SATURDAY",
    "SUNDAY"
],
```<br>- `from` - Indicate the starting time for alerts to be sent.
- `to` -<br>**Example**<br>```
"scheduled": {
    "days": [
        "TUESDAY",
        "THURSDAY"
    ],
    "from": "00:00",
    "to": "23:59"
},
``` |

#### Request example

```
curl --location --request POST 'https://api-us.devo.com/delco/policies' --header "standAloneToken:$token" --header 'Content-Type: application/json' --data '
{
  "name": "support36555example",
  "isDefault": false,
  "scheduled": {
    "days": [
      "MONDAY",
      "TUESDAY",
      "WEDNESDAY",
      "THURSDAY",
      "FRIDAY"
    ],
    "from": "00:00",
    "to": "23:59"
  },
  "deliveryMethods": [
    4668
  ]
}
'
```

 

### Response

Check the list of available responses:

| **Code** | **Description** |
| --- | --- |
| 200 | Successful response. Sending policy created.<br>```
{
  "id": 123,
  "name": "default-delivery",
  "isDefault": true,
  "scheduled": {
    "days": [
      "MONDAY",
      "TUESDAY",
      "WEDNESDAY",
      "THURSDAY",
      "FRIDAY",
      "SATURDAY",
      "SUNDAY"
    ],
    "from": "00:00",
    "to": "23:59"
  },
  "deliveryMethods": [
    {
      "id": 331,
      "type": "email",
      "name": "default-email"
    }
  ],
  "antiFloodingPolicy": {
    "id": 267,
    "name": "default AF"
  }
}
``` |
| 400 | Request error.<br>```
{
  "code": 400,
  "msg": "string",
  "cid": "string"
}
``` |
| 403 | Authentication required.<br>```
{
  "code": 403,
  "msg": "string",
  "cid": "string"
}
``` |

### > Macro (anchor)

<span style="color: #4c9aff">**PUT**</span>`/policies`

Edits an existing sending policy.

> ⚠️ To perform this request, your Devo user must have the Alert configuration (manage) permission assigned. Learn more about roles and permissions in this [article](https://docs.devo.com/space/latest/94763681).


###  Request

#### Request body

You must specify the updates you need to apply to the delivery method in the request body:

| **Parameter** | **Type** | **Definition** |
| --- | --- | --- |
| `name` <sup><span style="color: #ff5630">required</span></sup> | `string` | Name of the new sending policy. |
| `deliveryMethods` <sup><span style="color: #ff5630">required</span></sup> | `object` | Recipient of the alert, which corresponds to a [delivery method](https://devodocs.atlassian.net/wiki/spaces/latest/pages/413859864) created in the domain.<br>Define an object with the following parameters:<br>- `id` (`integer`) - The ID of the desired delivery method. You can use the [GET]`/methods` endpoint to check the ID (more details [here](https://devodocs.atlassian.net/wiki/spaces/latest/pages/413859864)).<br>**Example**<br>```
"deliveryMethods": [
    4668
  ]
```<br>Visit [Create and manage delivery methods](https://docs.devo.com/space/latest/95127270) to know more. |
| `isDefault` | `boolean` | If you set this to `true`, this policy will be automatically assigned to new alerts and predefined alerts that have not actively been assigned a sending policy. |
| `antiFloodingPolicy` |  | Frequency limit established for persistent alerts. You can choose between none, default, or one of your own creation.<br>Visit [Create and manage delivery methods](https://docs.devo.com/space/latest/95127270) to know more. |
| `scheduled` | `object` | Days and hours during which alerts should be distributed. The time zone defined in the delivery method(s) selected is used to calculate times.<br>Define an object with the following parameters:<br>- `days` (`string`) - Enter the weekdays you want the alert to be distributed. Indicate the specific days between brackets `[]`. For example:<br>```
"days": [
    "MONDAY",
    "TUESDAY",
    "WEDNESDAY",
    "THURSDAY",
    "FRIDAY",
    "SATURDAY",
    "SUNDAY"
],
```<br>- `from` - Indicate the starting time for alerts to be sent.
- `to` -<br>**Example**<br>```
"scheduled": {
    "days": [
        "TUESDAY",
        "THURSDAY"
    ],
    "from": "00:00",
    "to": "23:59"
},
``` |

#### Request example

```
curl --location --request PUT 'https://api-us.devo.com/delco/policies' --header "standAloneToken:$token" --header 'Content-Type: application/json' --data '
{
  "name": "support36555example",
  "isDefault": false,
  "scheduled": {
    "days": [
      "MONDAY",
      "TUESDAY",
      "WEDNESDAY",
      "THURSDAY",
      "FRIDAY"
    ],
    "from": "00:00",
    "to": "23:59"
  },
  "deliveryMethods": [
    4668
  ]
}
'
```

 

### Response

Check the list of available responses:

| **Code** | **Description** |
| --- | --- |
| 200 | Successful response. Sending policy created.<br>```
{
  "id": 123,
  "name": "default-delivery",
  "isDefault": true,
  "scheduled": {
    "days": [
      "MONDAY",
      "TUESDAY",
      "WEDNESDAY",
      "THURSDAY",
      "FRIDAY",
      "SATURDAY",
      "SUNDAY"
    ],
    "from": "00:00",
    "to": "23:59"
  },
  "deliveryMethods": [
    {
      "id": 331,
      "type": "email",
      "name": "default-email"
    }
  ],
  "antiFloodingPolicy": {
    "id": 267,
    "name": "default AF"
  }
}
``` |
| 400 | Request error.<br>```
{
  "code": 400,
  "msg": "string",
  "cid": "string"
}
``` |
| 403 | Authentication required.<br>```
{
  "code": 403,
  "msg": "string",
  "cid": "string"
}
``` |

### > Macro (anchor)

<span style="color: #ff5630">**DELETE**</span><span style="color: #00b8d9"> </span>`/policies/{id}`

Deletes a sending policy.

> ⚠️ To perform this request, your Devo user must have the Alert configuration (manage) permission assigned. Learn more about roles and permissions in this [article](https://docs.devo.com/space/latest/94763681).


###  Request

#### Path parameters

Add the following path parameters as part of the endpoint:

| **Parameter** | **Type** | **Definition** |
| --- | --- | --- |
| `id` <sup><span style="color: #ff5630">required</span></sup> | `integer` | ID of the sending policy you want to delete.<br>> ⚠️ **How can I get the ID of a sending policy**
> ⚠️ 
> ⚠️ You can use the <span style="color: #ff991f">**GET**</span><span style="color: #00b8d9">** **</span>`/policies` endpoint to get the IDs of the sending policies defined in your domain. |

#### Example

Find below a request example in cURL language. This request will delete the sending policy with ID `123` in the domain that corresponds to the given token. Learn how to authorize your request [in this article](https://docs.devo.com/space/latest/127762507).

```
curl -H "standAloneToken:YOUR_TOKEN" -X DELETE "https://api-us.devo.com/delco/policies/123"
```

 

### Response

Check the list of available responses:

| **Code** | **Description** |
| --- | --- |
| 204 | No content. Successful response. Sending policy deleted. |
| 400 | Request error.<br>```
{
  "code": 400,
  "msg": "string",
  "cid": "string"
}
``` |
| 403 | Authentication required.<br>```
{
  "code": 403,
  "msg": "string",
  "cid": "string"
}
``` |