# IP Pools

IP Pools allow you to group your dedicated IPs into customized "pools" to help manage your sending reputation for different mail sending streams.

## Remove an IP from the domain pool, unlink a DIPP or remove the domain pool

 - [DELETE /v3/domains/{name}/ips/{ip}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/delete-v3-domains--name--ips--ip-.md): The behavior of the endpoint depends on the value of the ip parameter. It can be
one of the following:
 * a valid IP address: this IP address will be removed from the domain pool.
 * string all: the entire domain pool will be removed. As far as the system is
   concerned, such domain will no longer exist.
 * string ip_pool: the DIPP which is currently linked to the domain will be
   unlinked.

### Removing An IP
Note that it's impossible to alter domain IPs if a DIPP is linked to the domain.

If the account is not eligible for shared IPs, additional rules apply:
 * removing the last IP from the domain is not allowed;
 * if all of the remaining dedicated IPs are on warmup, an extra IP might be added to
   the domain pool.

### Unlinking The DIPP
The account must have 'DIPPs' feature enabled.

Either ip or pool_id query parameter must be specified, but not both.

If the special value shared is used for the replacement IP, the account must be
eligible for shared IPs. In this case the system will assign a shared IP as the
replacement.

## Remove an IP from the domain pool, unlink a DIPP or remove the domain pool

 - [DELETE /v3/domains/{name}/pool/{ip}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/delete-v3-domains--name--pool--ip-.md): The behavior of the endpoint depends on the value of the ip parameter. It can be
one of the following:
 * a valid IP address: this IP address will be removed from the domain pool.
 * string all: the entire domain pool will be removed. As far as the system is
   concerned, such domain will no longer exist.
 * string ip_pool: the DIPP which is currently linked to the domain will be
   unlinked.

### Removing An IP
Note that it's impossible to alter domain IPs if a DIPP is linked to the domain.

If the account is not eligible for shared IPs, additional rules apply:
 * removing the last IP from the domain is not allowed;
 * if all of the remaining dedicated IPs are on warmup, an extra IP might be added to
   the domain pool.

### Unlinking The DIPP
The account must have 'DIPPs' feature enabled.

Either ip or pool_id query parameter must be specified, but not both.

If the special value shared is used for the replacement IP, the account must be
eligible for shared IPs. In this case the system will assign a shared IP as the
replacement.

## List dedicated IP pools of the account

 - [GET /v3/ip_pools](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/get-v3-ip-pools.md): #### Description
Lists all dedicated IP pools of the account. For each pool
returns its basic properties (name, description, the list of IPs)
and indicates whether the pool is linked to any domains and
whether it's an inherited one.

## Add a new DIPP to the account

 - [POST /v3/ip_pools](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/post-v3-ip-pools.md): The account must have 'DIPPs' feature enabled.

Returns the id of the newly created DIPP.

## Get DIPP details

 - [GET /v3/ip_pools/{pool_id}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/get-v3-ip-pools--pool-id-.md): is_linked in the response indicates whether the DIPP is currently linked to any
domains. If it's true, linked_domain lists those domains.

## Delete the DIPP

 - [DELETE /v3/ip_pools/{pool_id}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/delete-v3-ip-pools--pool-id-.md): The DIPPs feature must be enabled for the account.

It is not allowed to delete a DIPP inherited from the parent account.

If the DIPP is delegated to subaccounts, those will also be updated.

If the replacement DIPP is specified, all domains linked to the deleted DIPP will be
relinked to the replacement DIPP. The latter must contain at least one IP.

If the replacement IP is specified, all domains linked to the deleted DIPP will be
unlinked, and the replacement IP will be assigned to them. It is not allowed to
delete a DIPP inherited from the parent account and replace it with an IP
(subaccounts do not explicitly manage their IPs).

The replacement IP must be a dedicated one; it can't belong to another DIPP. If a
special value shared is used, appropriate shared IPs will be used (the account must
be eligible for shared IPs in this case).

Omitting both replacement DIPP and replacement IP is allowed only if the DIPP being
deleted contains no IPs.

The processing of affected domains and subaccounts happens asynchronously after the
endpoint returns a response.

## Edit DIPP

 - [PATCH /v3/ip_pools/{pool_id}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/patch-v3-ip-pools--pool-id-.md): The account must have 'DIPPs' feature enabled.

It's not allowed to edit a DIPP inherited from the parent account.

IPs being added to the DIPP must be dedicated ones and belong to the account.

If IPs of the DIPP end up modified, and the DIPP is linked to domains, the domains
will be updated asynchronously (after this endpoint returns response).

Returns an error if the passed parameters won't result in any changes.

## Get domains linked to DIPP

 - [GET /v3/ip_pools/{pool_id}/domains](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/get-v3-ip-pools--pool-id--domains.md): Returns a paginated list of domains that are linked to the specified
dedicated IP pool.

## Add an IP to a DIPP

 - [PUT /v3/ip_pools/{pool_id}/ips/{ip}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/put-v3-ip-pools--pool-id--ips--ip-.md): The account must have 'DIPPs' feature enabled.

It is not allowed to modify a DIPP inherited from the parent account.

The IP must be a dedicated one, belong to the account and not belong to any other
DIPP.

All domains linked to the DIPP will be updated so that their IPs include the newly
added address. If the DIPP is delegated to subaccounts, those will also be updated.

The processing of affected domains and subaccounts happens asynchronously after the
endpoint returns a response.

## Remove an IP from a DIPP

 - [DELETE /v3/ip_pools/{pool_id}/ips/{ip}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/delete-v3-ip-pools--pool-id--ips--ip-.md): The account must have 'DIPPs' feature enabled.

It's not allowed to edit a DIPP inherited from the parent account.

If the DIPP is linked to domains, the domains will be updated asynchronously (after
this endpoint returns response).

## Add multiple IPs to the DIPP

 - [POST /v3/ip_pools/{pool_id}/ips.json](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/post-v3-ip-pools--pool-id--ips-json.md): The account must have 'DIPPs' feature enabled.

It is not allowed to modify a DIPP inherited from the parent account.

All IPs must be dedicated ones, belong to the account and not belong to any other
DIPP.

All domains linked to the DIPP will be updated so that their IPs include the newly
added addresses. If the DIPP is delegated to subaccounts, those will also be updated.

The processing of affected domains and subaccounts happens asynchronously after the
endpoint returns a response.

## Delegate DIPP to Subaccount

 - [PUT /v3/ip_pools/{pool_id}/delegate](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/put-v3-ip-pools--pool-id--delegate.md): Delegates a dedicated IP pool (DIPP) from the parent account to a specified subaccount.
Unlike legacy endpoints, this supports accounts with multiple delegated DIPPs.

Request parameters are encoded as form data.

## Revoke DIPP from Subaccount

 - [DELETE /v3/ip_pools/{pool_id}/delegate](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ip-pools/delete-v3-ip-pools--pool-id--delegate.md): Revokes delegation of a dedicated IP pool (DIPP) from a specified subaccount.
The DIPP will no longer be available to the subaccount. Unlike
legacy endpoints, this supports accounts with multiple delegated DIPPs.

Request parameters are encoded as form data.

## Remove an IP from the domain pool, unlink a DIPP or remove the domain pool

 - [DELETE /v3/domains/{name}/ips/{ip}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ips/delete-v3-domains--name--ips--ip-.md): The behavior of the endpoint depends on the value of the ip parameter. It can be
one of the following:
 * a valid IP address: this IP address will be removed from the domain pool.
 * string all: the entire domain pool will be removed. As far as the system is
   concerned, such domain will no longer exist.
 * string ip_pool: the DIPP which is currently linked to the domain will be
   unlinked.

### Removing An IP
Note that it's impossible to alter domain IPs if a DIPP is linked to the domain.

If the account is not eligible for shared IPs, additional rules apply:
 * removing the last IP from the domain is not allowed;
 * if all of the remaining dedicated IPs are on warmup, an extra IP might be added to
   the domain pool.

### Unlinking The DIPP
The account must have 'DIPPs' feature enabled.

Either ip or pool_id query parameter must be specified, but not both.

If the special value shared is used for the replacement IP, the account must be
eligible for shared IPs. In this case the system will assign a shared IP as the
replacement.

## Remove an IP from the domain pool, unlink a DIPP or remove the domain pool

 - [DELETE /v3/domains/{name}/pool/{ip}](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/ips/delete-v3-domains--name--pool--ip-.md): The behavior of the endpoint depends on the value of the ip parameter. It can be
one of the following:
 * a valid IP address: this IP address will be removed from the domain pool.
 * string all: the entire domain pool will be removed. As far as the system is
   concerned, such domain will no longer exist.
 * string ip_pool: the DIPP which is currently linked to the domain will be
   unlinked.

### Removing An IP
Note that it's impossible to alter domain IPs if a DIPP is linked to the domain.

If the account is not eligible for shared IPs, additional rules apply:
 * removing the last IP from the domain is not allowed;
 * if all of the remaining dedicated IPs are on warmup, an extra IP might be added to
   the domain pool.

### Unlinking The DIPP
The account must have 'DIPPs' feature enabled.

Either ip or pool_id query parameter must be specified, but not both.

If the special value shared is used for the replacement IP, the account must be
eligible for shared IPs. In this case the system will assign a shared IP as the
replacement.

