# Web Cloud › Web Cloud DB › Allowed IPs API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Web Cloud product's sections: https://developers.eu.ovhcloud.com/reference/web-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 8 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/web-cloud-db/allowed-ips.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/web-cloud-db/allowed-ips.json?format=openapi3

## Operations

- `GET /hosting/privateDatabase/{serviceName}/webhostingNetwork` — Get web hosting network access
- `POST /hosting/privateDatabase/{serviceName}/webhostingNetwork` — Enable web hosting network access
- `DELETE /hosting/privateDatabase/{serviceName}/webhostingNetwork` — Disable web hosting network access
- `GET /hosting/privateDatabase/{serviceName}/whitelist` — List allowed IPs
- `POST /hosting/privateDatabase/{serviceName}/whitelist` — Add an allowed IP
- `GET /hosting/privateDatabase/{serviceName}/whitelist/{ip}` — Get an allowed IP
- `PUT /hosting/privateDatabase/{serviceName}/whitelist/{ip}` — Update an allowed IP
- `DELETE /hosting/privateDatabase/{serviceName}/whitelist/{ip}` — Delete an allowed IP

## Get web hosting network access

`GET /1.0/hosting/privateDatabase/{serviceName}/webhostingNetwork`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#get-hosting-privatedatabase-servicename-webhostingnetwork

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:webhostingNetwork/get`

Returns whether OVHcloud web hostings can reach the service: enabled, disabled, or being changed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.privateDatabase.webhostingNetwork | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | hosting.privateDatabase.webhostingNetwork.StatusEnum | read-only | Webhosting network status — one of `disabled`, `disabling`, `enabled`, `enabling` |

```json
{
  "status": "disabled"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/webhostingNetwork" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/hosting/privateDatabase/{serviceName}/webhostingNetwork")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/hosting/privateDatabase/{serviceName}/webhostingNetwork");

print_r($result);
?>
```

## Enable web hosting network access

`POST /1.0/hosting/privateDatabase/{serviceName}/webhostingNetwork`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#post-hosting-privatedatabase-servicename-webhostingnetwork

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:webhostingNetwork/create`

Allows connections from OVHcloud web hostings to the service. Returns a task to follow the change.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.privateDatabase.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `databaseName` | string | read-only | Database name on which the task is working |
| `doneDate` | string (date-time) | read-only | Completion date |
| `dumpId` | integer | read-only | DumpId on which the task is working |
| `function` | hosting.privateDatabase.task.FunctionEnum | read-only | Function name — one of `abuse`, `changeFtpPassword`, `changeRam`, `changeVersion`, `configuration/update`, `create`, `database/copy`, `database/copyRestore`, `database/create`, `database/delete`, `database/dump`, `database/dump/delete`, … |
| `id` | integer | read-only | The id of the task |
| `lastUpdate` | string (date-time) | read-only | Last update |
| `startDate` | string (date-time) | read-only | Task creation date |
| `status` | hosting.privateDatabase.task.StatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `userName` | string | read-only | User name on which the task is working |

```json
{
  "databaseName": "string",
  "doneDate": "2024-01-01T12:00:00Z",
  "dumpId": 0,
  "function": "abuse",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "userName": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/webhostingNetwork" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/hosting/privateDatabase/{serviceName}/webhostingNetwork")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/hosting/privateDatabase/{serviceName}/webhostingNetwork");

print_r($result);
?>
```

## Disable web hosting network access

`DELETE /1.0/hosting/privateDatabase/{serviceName}/webhostingNetwork`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#delete-hosting-privatedatabase-servicename-webhostingnetwork

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:webhostingNetwork/delete`

Blocks connections from OVHcloud web hostings to the service. Returns a task to follow the change.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.privateDatabase.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `databaseName` | string | read-only | Database name on which the task is working |
| `doneDate` | string (date-time) | read-only | Completion date |
| `dumpId` | integer | read-only | DumpId on which the task is working |
| `function` | hosting.privateDatabase.task.FunctionEnum | read-only | Function name — one of `abuse`, `changeFtpPassword`, `changeRam`, `changeVersion`, `configuration/update`, `create`, `database/copy`, `database/copyRestore`, `database/create`, `database/delete`, `database/dump`, `database/dump/delete`, … |
| `id` | integer | read-only | The id of the task |
| `lastUpdate` | string (date-time) | read-only | Last update |
| `startDate` | string (date-time) | read-only | Task creation date |
| `status` | hosting.privateDatabase.task.StatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `userName` | string | read-only | User name on which the task is working |

```json
{
  "databaseName": "string",
  "doneDate": "2024-01-01T12:00:00Z",
  "dumpId": 0,
  "function": "abuse",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "userName": "string"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/webhostingNetwork" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/hosting/privateDatabase/{serviceName}/webhostingNetwork")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/hosting/privateDatabase/{serviceName}/webhostingNetwork");

print_r($result);
?>
```

## List allowed IPs

`GET /1.0/hosting/privateDatabase/{serviceName}/whitelist`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#get-hosting-privatedatabase-servicename-whitelist

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:whitelist/get`

Returns the IPs and IP blocks allowed to access the service.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | query | string |  | Filter the value of ip property (contains or equals) |
| `service` | query | boolean |  | Filter the value of service property |
| `serviceName` | path | string | yes | Service name |
| `sftp` | query | boolean |  | Filter the value of sftp property |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ipv4Block[] | successful operation |

```json
[
  "192.0.2.0/24"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/whitelist" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/hosting/privateDatabase/{serviceName}/whitelist")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/hosting/privateDatabase/{serviceName}/whitelist");

print_r($result);
?>
```

## Add an allowed IP

`POST /1.0/hosting/privateDatabase/{serviceName}/whitelist`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#post-hosting-privatedatabase-servicename-whitelist

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:whitelist/create`

Allows an IP or IP block to access the service port, the SFTP port, or both. Returns a task to follow the change.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `hosting.privateDatabase.Whitelist.CreatePayload`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ip` | string | yes | The IP allowed to access your Web Cloud Database |
| `name` | string |  | Custom name for your allowed IP |
| `service` | boolean |  | Authorize this IP to access service port |
| `sftp` | boolean |  | Authorize this IP to access sftp port |

```json
{
  "ip": "string",
  "name": "string",
  "service": true,
  "sftp": true
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.privateDatabase.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `databaseName` | string | read-only | Database name on which the task is working |
| `doneDate` | string (date-time) | read-only | Completion date |
| `dumpId` | integer | read-only | DumpId on which the task is working |
| `function` | hosting.privateDatabase.task.FunctionEnum | read-only | Function name — one of `abuse`, `changeFtpPassword`, `changeRam`, `changeVersion`, `configuration/update`, `create`, `database/copy`, `database/copyRestore`, `database/create`, `database/delete`, `database/dump`, `database/dump/delete`, … |
| `id` | integer | read-only | The id of the task |
| `lastUpdate` | string (date-time) | read-only | Last update |
| `startDate` | string (date-time) | read-only | Task creation date |
| `status` | hosting.privateDatabase.task.StatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `userName` | string | read-only | User name on which the task is working |

```json
{
  "databaseName": "string",
  "doneDate": "2024-01-01T12:00:00Z",
  "dumpId": 0,
  "function": "abuse",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "userName": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/whitelist" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: hosting.privateDatabase.Whitelist.CreatePayload
result = client.post("/hosting/privateDatabase/{serviceName}/whitelist",
	ip = None, # The IP allowed to access your Web Cloud Database (type: string)
	name = None, # Custom name for your allowed IP (type: string, nullable)
	service = None, # Authorize this IP to access service port (type: boolean)
	sftp = None, # Authorize this IP to access sftp port (type: boolean)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: hosting.privateDatabase.Whitelist.CreatePayload
$result = $ovh->post("/hosting/privateDatabase/{serviceName}/whitelist", array(
	ip => null, // The IP allowed to access your Web Cloud Database (type: string)
	name => null, // Custom name for your allowed IP (type: string, nullable)
	service => null, // Authorize this IP to access service port (type: boolean)
	sftp => null, // Authorize this IP to access sftp port (type: boolean)
));

print_r($result);
?>
```

## Get an allowed IP

`GET /1.0/hosting/privateDatabase/{serviceName}/whitelist/{ip}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#get-hosting-privatedatabase-servicename-whitelist-ip

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:whitelist/get`

Returns the name and status of the allowed IP, and whether it can access the service port and the SFTP port.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipv4Block | yes | Ip |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.privateDatabase.Whitelist | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date of this allowed IP |
| `ip` | ipv4Block | read-only | The IP allowed to access your Web Cloud Database |
| `lastUpdate` | string (date-time) | read-only | The last update date of this allowed IP |
| `name` | string |  | Custom name for your allowed IP |
| `service` | boolean |  | Authorize this IP to access service port |
| `sftp` | boolean |  | Authorize this IP to access sftp port |
| `status` | hosting.privateDatabase.whitelist.StatusEnum | read-only | Allowed IP status — one of `created`, `creating`, `deleting`, `updating` |
| `taskId` | integer | read-only | The id of the task working on this object |

```json
{
  "creationDate": "2024-01-01T12:00:00Z",
  "ip": "192.0.2.0/24",
  "lastUpdate": "2024-01-01T12:00:00Z",
  "name": "string",
  "service": true,
  "sftp": true,
  "status": "created",
  "taskId": 0
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/whitelist/{ip}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/hosting/privateDatabase/{serviceName}/whitelist/{ip}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/hosting/privateDatabase/{serviceName}/whitelist/{ip}");

print_r($result);
?>
```

## Update an allowed IP

`PUT /1.0/hosting/privateDatabase/{serviceName}/whitelist/{ip}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#put-hosting-privatedatabase-servicename-whitelist-ip

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:whitelist/edit`

Updates the name of the allowed IP and its access to the service port and the SFTP port.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipv4Block | yes | Ip |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `hosting.privateDatabase.Whitelist`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `creationDate` | string (date-time) | read-only | Creation date of this allowed IP |
| `ip` | ipv4Block | read-only | The IP allowed to access your Web Cloud Database |
| `lastUpdate` | string (date-time) | read-only | The last update date of this allowed IP |
| `name` | string |  | Custom name for your allowed IP |
| `service` | boolean |  | Authorize this IP to access service port |
| `sftp` | boolean |  | Authorize this IP to access sftp port |
| `status` | hosting.privateDatabase.whitelist.StatusEnum | read-only | Allowed IP status — one of `created`, `creating`, `deleting`, `updating` |
| `taskId` | integer | read-only | The id of the task working on this object |

```json
{
  "name": "string",
  "service": true,
  "sftp": true
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | — | successful operation |

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/whitelist/{ip}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: hosting.privateDatabase.Whitelist
result = client.put("/hosting/privateDatabase/{serviceName}/whitelist/{ip}",
	name = None, # Custom name for your allowed IP (type: string, nullable)
	service = None, # Authorize this IP to access service port (type: boolean)
	sftp = None, # Authorize this IP to access sftp port (type: boolean)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: hosting.privateDatabase.Whitelist
$result = $ovh->put("/hosting/privateDatabase/{serviceName}/whitelist/{ip}", array(
	name => null, // Custom name for your allowed IP (type: string, nullable)
	service => null, // Authorize this IP to access service port (type: boolean)
	sftp => null, // Authorize this IP to access sftp port (type: boolean)
));

print_r($result);
?>
```

## Delete an allowed IP

`DELETE /1.0/hosting/privateDatabase/{serviceName}/whitelist/{ip}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-cloud-db/allowed-ips/#delete-hosting-privatedatabase-servicename-whitelist-ip

**Status:** Stable production version  
**IAM actions:** `webCloudDatabases:apiovh:whitelist/delete`

Removes the IP from the allowed list, so it can no longer access the service.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipv4Block | yes | Ip |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.privateDatabase.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `databaseName` | string | read-only | Database name on which the task is working |
| `doneDate` | string (date-time) | read-only | Completion date |
| `dumpId` | integer | read-only | DumpId on which the task is working |
| `function` | hosting.privateDatabase.task.FunctionEnum | read-only | Function name — one of `abuse`, `changeFtpPassword`, `changeRam`, `changeVersion`, `configuration/update`, `create`, `database/copy`, `database/copyRestore`, `database/create`, `database/delete`, `database/dump`, `database/dump/delete`, … |
| `id` | integer | read-only | The id of the task |
| `lastUpdate` | string (date-time) | read-only | Last update |
| `startDate` | string (date-time) | read-only | Task creation date |
| `status` | hosting.privateDatabase.task.StatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `error`, `todo` |
| `userName` | string | read-only | User name on which the task is working |

```json
{
  "databaseName": "string",
  "doneDate": "2024-01-01T12:00:00Z",
  "dumpId": 0,
  "function": "abuse",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "userName": "string"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/hosting/privateDatabase/{serviceName}/whitelist/{ip}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/hosting/privateDatabase/{serviceName}/whitelist/{ip}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/hosting/privateDatabase/{serviceName}/whitelist/{ip}");

print_r($result);
?>
```
