# Manage & Operate › API Access API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Manage & Operate product's sections: https://developers.eu.ovhcloud.com/reference/manage-operate/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 5 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/manage-operate/api-access/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/manage-operate/api-access.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/manage-operate/api-access.json?format=openapi3

## Operations

- `GET /me/api/credential` — Retrieve all credentials
- `GET /me/api/credential/{credentialId}` — Retrieve information about a credential
- `PUT /me/api/credential/{credentialId}` — Edit a credential
- `DELETE /me/api/credential/{credentialId}` — Delete a credential
- `GET /me/api/credential/{credentialId}/application` — Get associated application

## Retrieve all credentials

`GET /1.0/me/api/credential`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/api-access/#get-me-api-credential

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/api/credential/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `applicationId` | query | integer |  | Filter by applicationId |
| `status` | query | auth.CredentialStateEnum |  | Filter by status — one of `expired`, `pendingValidation`, `refused`, `validated` |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/api/credential" \
  -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("/me/api/credential")

# 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("/me/api/credential");

print_r($result);
?>
```

## Retrieve information about a credential

`GET /1.0/me/api/credential/{credentialId}`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/api-access/#get-me-api-credential-credentialid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/api/credential/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `credentialId` | path | integer | yes | Credential ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | auth.ApiCredential | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `allowedIPs` | ipBlock[] |  | If defined, list of ip blocks which are allowed to call API with this credential |
| `applicationId` | integer | read-only | ID of associated API Application |
| `creation` | string (date-time) | read-only | Creation date of this credential |
| `credentialId` | integer | read-only | ID of this credential |
| `expiration` | string (date-time) | read-only | Expiration date of this credential |
| `lastUse` | string (date-time) | read-only | Last use date of this credential |
| `ovhSupport` | boolean | read-only | States whether this credential has been created by yourself or by the OVH support team |
| `rules` | auth.AccessRule[] | read-only | API routes allowed to this credential |
| `rules[].method` | auth.HTTPMethodEnum | read-only | Allowed Method — one of `DELETE`, `GET`, `PATCH`, `POST`, `PUT` |
| `rules[].path` | string | read-only | Allowed path |
| `status` | auth.CredentialStateEnum | read-only | State of to this credential — one of `expired`, `pendingValidation`, `refused`, `validated` |

```json
{
  "allowedIPs": [
    "192.0.2.0/24"
  ],
  "applicationId": 0,
  "creation": "2024-01-01T12:00:00Z",
  "credentialId": 0,
  "expiration": "2024-01-01T12:00:00Z",
  "lastUse": "2024-01-01T12:00:00Z",
  "ovhSupport": true,
  "rules": [
    {
      "method": "DELETE",
      "path": "string"
    }
  ],
  "status": "expired"
}
```

### Example

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

# 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("/me/api/credential/{credentialId}");

print_r($result);
?>
```

## Edit a credential

`PUT /1.0/me/api/credential/{credentialId}`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/api-access/#put-me-api-credential-credentialid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/api/credential/edit`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `credentialId` | path | integer | yes | Credential ID |

### Request body (required)

Type: `auth.ApiCredential`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `allowedIPs` | ipBlock[] |  | If defined, list of ip blocks which are allowed to call API with this credential |
| `applicationId` | integer | read-only | ID of associated API Application |
| `creation` | string (date-time) | read-only | Creation date of this credential |
| `credentialId` | integer | read-only | ID of this credential |
| `expiration` | string (date-time) | read-only | Expiration date of this credential |
| `lastUse` | string (date-time) | read-only | Last use date of this credential |
| `ovhSupport` | boolean | read-only | States whether this credential has been created by yourself or by the OVH support team |
| `rules` | auth.AccessRule[] | read-only | API routes allowed to this credential |
| `rules[].method` | auth.HTTPMethodEnum | read-only | Allowed Method — one of `DELETE`, `GET`, `PATCH`, `POST`, `PUT` |
| `rules[].path` | string | read-only | Allowed path |
| `status` | auth.CredentialStateEnum | read-only | State of to this credential — one of `expired`, `pendingValidation`, `refused`, `validated` |

```json
{
  "allowedIPs": [
    "192.0.2.0/24"
  ]
}
```

### Responses

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

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/me/api/credential/{credentialId}" \
  -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: auth.ApiCredential
result = client.put("/me/api/credential/{credentialId}",
	allowedIPs = None, # If defined, list of ip blocks which are allowed to call API with this credential (type: array, nullable)
)

# 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: auth.ApiCredential
$result = $ovh->put("/me/api/credential/{credentialId}", array(
	allowedIPs => null, // If defined, list of ip blocks which are allowed to call API with this credential (type: array, nullable)
));

print_r($result);
?>
```

## Delete a credential

`DELETE /1.0/me/api/credential/{credentialId}`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/api-access/#delete-me-api-credential-credentialid

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/api/credential/delete`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `credentialId` | path | integer | yes | Credential ID |

### Responses

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

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/me/api/credential/{credentialId}" \
  -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("/me/api/credential/{credentialId}")

# 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("/me/api/credential/{credentialId}");

print_r($result);
?>
```

## Get associated application

`GET /1.0/me/api/credential/{credentialId}/application`

Link: https://developers.eu.ovhcloud.com/reference/manage-operate/api-access/#get-me-api-credential-credentialid-application

**Status:** Stable production version  
**IAM actions:** `account:apiovh:me/api/credential/application/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `credentialId` | path | integer | yes | Credential ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | auth.ApiApplication | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `applicationId` | integer | read-only | ID of this Application |
| `applicationKey` | string | read-only | Key of this application |
| `description` | string | read-only | Description of this application |
| `name` | string | read-only | Name of this application |
| `status` | auth.ApplicationStatusEnum | read-only | Status of this application — one of `active`, `blocked`, `inactive`, `trusted` |

```json
{
  "applicationId": 0,
  "applicationKey": "string",
  "description": "string",
  "name": "string",
  "status": "active"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/me/api/credential/{credentialId}/application" \
  -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("/me/api/credential/{credentialId}/application")

# 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("/me/api/credential/{credentialId}/application");

print_r($result);
?>
```
