# Public Cloud › Project Management › Access Control API

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

> 4 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/public-cloud/project-management/access-control/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/project-management/access-control.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/project-management/access-control.json?format=openapi3

## Operations

- `GET /cloud/project/{serviceName}/acl` — List project ACLs
- `GET /cloud/project/{serviceName}/acl/{accountId}` — Get a project ACL
- `POST /cloud/project/{serviceName}/acl` — Grant access to the project
- `DELETE /cloud/project/{serviceName}/acl/{accountId}` — Revoke access to the project

## List project ACLs

`GET /1.0/cloud/project/{serviceName}/acl`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/access-control/#get-cloud-project-servicename-acl

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:acl/get`

List project ACLs. Returns the OVHcloud accounts that have access to the project. Filter by access type with the `type` parameter.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The project id |
| `type` | query | cloud.AclTypeEnum |  | Filter the value of type property (=) — one of `readOnly`, `readWrite` |

### Responses

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

```json
[
  "string"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/acl" \
  -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("/cloud/project/{serviceName}/acl")

# 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("/cloud/project/{serviceName}/acl");

print_r($result);
?>
```

## Get a project ACL

`GET /1.0/cloud/project/{serviceName}/acl/{accountId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/access-control/#get-cloud-project-servicename-acl-accountid

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:acl/get`

Get a project ACL. Returns the access type of one OVHcloud account on the project: read-only or read-write.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `accountId` | path | string | yes | OVH customer unique identifier |
| `serviceName` | path | string | yes | The project id |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cloud.Acl | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | string | read-only | OVH customer unique identifier |
| `type` | cloud.AclTypeEnum | read-only | ACL type — one of `readOnly`, `readWrite` |

```json
{
  "accountId": "string",
  "type": "readOnly"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/acl/{accountId}" \
  -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("/cloud/project/{serviceName}/acl/{accountId}")

# 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("/cloud/project/{serviceName}/acl/{accountId}");

print_r($result);
?>
```

## Grant access to the project

`POST /1.0/cloud/project/{serviceName}/acl`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/access-control/#post-cloud-project-servicename-acl

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:acl/create`

Grant access to the project. Gives another OVHcloud account read-only or read-write access to the project.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The project id |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | string | yes | Deleguates rights to |
| `type` | cloud.AclTypeEnum | yes | Acl type — one of `readOnly`, `readWrite` |

```json
{
  "accountId": "string",
  "type": "readOnly"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | cloud.Acl | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | string | read-only | OVH customer unique identifier |
| `type` | cloud.AclTypeEnum | read-only | ACL type — one of `readOnly`, `readWrite` |

```json
{
  "accountId": "string",
  "type": "readOnly"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/acl" \
  -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
)

result = client.post("/cloud/project/{serviceName}/acl",
	accountId = None, # Deleguates rights to (type: coreTypes.AccountId:string)
	type = None, # Acl type (type: cloud.AclTypeEnum)
)

# 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("/cloud/project/{serviceName}/acl", array(
	accountId => null, // Deleguates rights to (type: coreTypes.AccountId:string)
	type => null, // Acl type (type: cloud.AclTypeEnum)
));

print_r($result);
?>
```

## Revoke access to the project

`DELETE /1.0/cloud/project/{serviceName}/acl/{accountId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/project-management/access-control/#delete-cloud-project-servicename-acl-accountid

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:acl/delete`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `accountId` | path | string | yes | OVH customer unique identifier |
| `serviceName` | path | string | yes | The project id |

### Responses

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

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/cloud/project/{serviceName}/acl/{accountId}" \
  -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("/cloud/project/{serviceName}/acl/{accountId}")

# 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("/cloud/project/{serviceName}/acl/{accountId}");

print_r($result);
?>
```
