---
title: "Generate API and secret keys for a user / service account"
description: "If you want to connect to the Data Platform from outside of the platform, you will need to generate API and secret keys to authenticate"
url: https://docs.ovhcloud.com/en/guides/public-cloud/data-platform/tutorials-generate-api-keys
lang: en
lastUpdated: 2026-09-14
---
> For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/en/llms-full.txt.

# Generate API and secret keys for a user / service account

## Objective

If you want to connect to the Data Platform from outside of the platform, you will need to generate **API and secret keys** to authenticate. The _API key_ is the public key associated to the user who is connecting to an API. The _secret key_ is the private key known only to the user. The combination of the two is used to authenticate, through the generation of temporary [authentication tokens](#generate-an-authentication-token).

API and secret keys can be generated per [user](https://docs.ovhcloud.com/en/guides/public-cloud/data-platform/iam-users.md) or [service account](https://docs.ovhcloud.com/en/guides/public-cloud/data-platform/iam-service-accounts.md).

## Generate a new set of API and secret keys

### For a user

Navigate to the **Users** tab of the Identity Access Manager. Search for the user for which you want to generate API & Secret keys, using the search bar on the top right if needed. Edit the user.

![For a user — Users search](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/users-search.png)
In the user's settings, scroll down to the **API Access** panel and click on _Add access_.

![For a user — Users api key](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/users-api-key.png)
Select the lifetime of the keys (i.e. the expiration date from today) and whether you want to send an email to the user with the API & secret key information. Then press **Create**.

:::info
The _Default_ value can be changed in your Identity Access Manager settings.
:::

![For a user — Users api key options](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/users-api-key-options.png)
A new window will open with the API and secret key values.

:::warning
After closing the window, there is no way to view the secret key again. Make sure you keep a record a the keys either by sending an email to the user or storing them in your code.
:::

![For a user — Users api key confirmation](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/users-api-key-confirmation.png)
To delete a key, hover over the key that you would like to delete and click on the **trash** 🗑️ icon. Once the key is deleted, the credentials for the keys will become inactive and cannot be use to authenticate anymore.

![For a user — Users api key deleting](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/users-api-key-deleting.png)
### For a service account

Navigate to the **Service Accounts** tab of the Identity Access Manager. Search for the service account for which you want to generate API & Secret keys, using the search bar on the top-right if needed.

![For a service account — Sa search](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/sa-search.png)
In the service account settings, locate the **API Access** panel and click on _Add access_.

![For a service account — Sa api key](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/sa-api-key.png)
After that, the [process is the same as for users](#for-a-user). Note that if you want to send an email with a record of the API and secret keys, you need to fill in an email address for the service account.

![For a service account — Sa email](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/sa-email.png)
## Generate an authentication token

### Generation scripts

Once you've created API & secret keys, you need to generate a dynamic authentication token in order to authenticate to Data Platform via an API endpoint. Authentication tokens are only active for a short time: this duration can be configured in your IAM settings.

![Generation scripts — Token settings](/images/public-cloud/data-platform/getting-further/generate-api-key/picts/token-settings.png)
To generate a token, simply run the command samples below.


**cURL**

```bash
curl --request POST \
  --url https://{project_subdomain}.eu.dataplatform.ovh.net/iam/login \
  --header 'Content-Type: application/json' \
  --data '{
    "auth_mode": "apikey",
    "apikey": "",
    "secretkey": ""
  }'
```


**Python 3+**

```python
import requests

url = "https://{project_subdomain}.eu.dataplatform.ovh.net/iam/login"

payload = {
  "auth_mode": "apikey",
  "apikey": "",
  "secretkey": ""
}

response = requests.request("POST", url, data=payload)

print(response.text)
```


:::warning
Make to update the **\{project\_subdomain}** else your calls won't go through.
:::

[How to find your Project subdomain.](https://docs.ovhcloud.com/en/guides/public-cloud/data-platform/manage-projects-config-variables.md#project-subdomain)

## Go further

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/en-gb/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated [Discord channel](https://discord.gg/ovhcloud).

If you need support with your OVHcloud services, create a request in our [Help Centre](https://help.ovhcloud.com/csm?id=csm_get_help).

Join our [community of users](https://community.ovhcloud.com/).
