Skip to content

Secrets

All operations require authentication.

11 operationsv2/okms/resource
Agent setup

List secretsProduction

GET
/v2/okms/resource/{okmsId}/secret

Lists secret paths with metadata (versions, CAS settings). The content of secret versions is not accessible through this API.

Path parameters

okmsId
required
stringuuid

Okms ID

Query parameters

iamTags
object

Filter resources on IAM tags

Headers

X-Pagination-Cursor
string

Pagination cursor

X-Pagination-Size
integer

Pagination size

Response

200GetResponseWithIAM[]successful operation
iam
read-only
ResourceMetadata

IAM resource metadata

metadata
read-only
Metadata

Secret metadata

path
read-only
string

Unique identifier of the secret

version
read-only
Version

Data of the secret version

400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
[ { "iam": { "displayName": "string", "id": "00000000-0000-0000-0000-000000000000", "state": "EXPIRED", "tags": { "key": "string" }, "urn": "string" }, "metadata": { "casRequired": true, "createdAt": "2024-01-01T12:00:00Z", "currentVersion": 0, "customMetadata": { "key": "string" }, "deactivateVersionAfter": "string", "maxVersions": 0, "oldestVersion": 0, "updatedAt": "2024-01-01T12:00:00Z" }, "path": "string", "version": { "createdAt": "2024-01-01T12:00:00Z", "data": "This is a content of any type !", "deactivatedAt": "2024-01-01T12:00:00Z", "id": 0, "state": "ACTIVE" } }]

Create a secretProduction

POST
/v2/okms/resource/{okmsId}/secret

Creates a secret at the given path and stores the first version. Path and engine defaults (CAS, max versions) apply from the service secret config unless overridden in the body.

Path parameters

okmsId
required
stringuuid

Okms ID

Request body (required)

metadata
MetadataRequest

Secret metadata

path
required
string

Secret path

version
required
Creation

Data of the secret version

Response

200PostResponsesuccessful operation
metadata
read-only
Metadata

Secret metadata

path
read-only
string

Secret identifier

400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "metadata": { "casRequired": true, "createdAt": "2024-01-01T12:00:00Z", "currentVersion": 0, "customMetadata": { "key": "string" }, "deactivateVersionAfter": "string", "maxVersions": 0, "oldestVersion": 0, "updatedAt": "2024-01-01T12:00:00Z" }, "path": "string"}

Get a secretProduction

GET
/v2/okms/resource/{okmsId}/secret/{path}

Returns a secret's metadata. By default the latest version is selected. Pass version to target another one.

Set includeData=true to also return that version's data (requires the matching IAM action).

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

Query parameters

includeData
boolean

Secret data

version
integer

Secret version. When omitted, the latest version will be returned.

Response

200GetResponseWithIAMsuccessful operation
iam
read-only
ResourceMetadata

IAM resource metadata

metadata
read-only
Metadata

Secret metadata

path
read-only
string

Unique identifier of the secret

version
read-only
Version

Data of the secret version

400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "iam": { "displayName": "string", "id": "00000000-0000-0000-0000-000000000000", "state": "EXPIRED", "tags": { "key": "string" }, "urn": "string" }, "metadata": { "casRequired": true, "createdAt": "2024-01-01T12:00:00Z", "currentVersion": 0, "customMetadata": { "key": "string" }, "deactivateVersionAfter": "string", "maxVersions": 0, "oldestVersion": 0, "updatedAt": "2024-01-01T12:00:00Z" }, "path": "string", "version": { "createdAt": "2024-01-01T12:00:00Z", "data": "This is a content of any type !", "deactivatedAt": "2024-01-01T12:00:00Z", "id": 0, "state": "ACTIVE" }}

Update a secretProduction

PUT
/v2/okms/resource/{okmsId}/secret/{path}

Updates the secret: include version.data to add a new version, and/or metadata to change this secret's engine settings. When cas is set, it must equal the current version for the write to succeed.

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

Query parameters

cas
integer

Current secret version number. When the cas (Check and set) is specified, the current version of the secret is verified before updating it. In order for a write to be successful,cas must be set to the current version of the secret.

Request body (required)

metadata
MetadataRequest

Secret metadata

version
Creation

Secret version

Response

200PostResponsesuccessful operation
metadata
read-only
Metadata

Secret metadata

path
read-only
string

Secret identifier

400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "metadata": { "casRequired": true, "createdAt": "2024-01-01T12:00:00Z", "currentVersion": 0, "customMetadata": { "key": "string" }, "deactivateVersionAfter": "string", "maxVersions": 0, "oldestVersion": 0, "updatedAt": "2024-01-01T12:00:00Z" }, "path": "string"}

Delete a secretProduction

DELETE
/v2/okms/resource/{okmsId}/secret/{path}

Deletes the secret and all its versions.

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

Response

200—successful operation

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path} \
  -H "authorization: Bearer $OVH_TOKEN"

List secret versionsProduction

GET
/v2/okms/resource/{okmsId}/secret/{path}/version

Lists version numbers and states for the secret. Version data is not returned by this API.

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

Headers

X-Pagination-Cursor
string

Pagination cursor

X-Pagination-Size
integer

Pagination size

Response

200Version[]successful operation
createdAt
read-only
stringdate-time

Time of creation of the secret version

data
read-only
any

Secret version data

deactivatedAt
read-only
stringdate-time

Time of deactivation of the secret version

id
read-only
integer

Secret version

state
read-only
SecretStateEnum

State of the secret version

ValuesACTIVEDEACTIVATEDDELETED
400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path}/version \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
[ { "createdAt": "2024-01-01T12:00:00Z", "data": "This is a content of any type !", "deactivatedAt": "2024-01-01T12:00:00Z", "id": 0, "state": "ACTIVE" }]

Create a secret versionProduction

POST
/v2/okms/resource/{okmsId}/secret/{path}/version

Appends a new version of the secret data. Optional cas must match the current version or the write is rejected.

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

Query parameters

cas
integer

Current secret version number. When the cas (Check and set) is specified, the current version of the secret is verified before updating it. In order for a write to be successful,cas must be set to the current version of the secret.

Request body (required)

data
required
any

Secret version data in key value json format

Response

200Versionsuccessful operation
createdAt
read-only
stringdate-time

Time of creation of the secret version

data
read-only
any

Secret version data

deactivatedAt
read-only
stringdate-time

Time of deactivation of the secret version

id
read-only
integer

Secret version

state
read-only
SecretStateEnum

State of the secret version

ValuesACTIVEDEACTIVATEDDELETED
400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path}/version \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "createdAt": "2024-01-01T12:00:00Z", "data": "This is a content of any type !", "deactivatedAt": "2024-01-01T12:00:00Z", "id": 0, "state": "ACTIVE"}

Get a secret versionProduction

GET
/v2/okms/resource/{okmsId}/secret/{path}/version/{version}

Returns one version's metadata. Set includeData=true to also return the version data.

Reading the data requires a specific IAM right.

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

version
required
integer

Version

Query parameters

includeData
boolean

Secret version data

Response

200Versionsuccessful operation
createdAt
read-only
stringdate-time

Time of creation of the secret version

data
read-only
any

Secret version data

deactivatedAt
read-only
stringdate-time

Time of deactivation of the secret version

id
read-only
integer

Secret version

state
read-only
SecretStateEnum

State of the secret version

ValuesACTIVEDEACTIVATEDDELETED
400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string, version = 0

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path}/version/{version} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "createdAt": "2024-01-01T12:00:00Z", "data": "This is a content of any type !", "deactivatedAt": "2024-01-01T12:00:00Z", "id": 0, "state": "ACTIVE"}

Update the state of a secret versionProduction

PUT
/v2/okms/resource/{okmsId}/secret/{path}/version/{version}

Changes the version state: activate, deactivate, or delete.

To modify the secret data, create a new version.

Path parameters

okmsId
required
stringuuid

Okms ID

path
required
string

Path

version
required
integer

Version

Request body (required)

state
required
SecretStateEnum

State of the secret version

ValuesACTIVEDEACTIVATEDDELETED

Response

200UpdateResponsesuccessful operation
createdAt
read-only
stringdate-time

Time of creation of the secret version

deactivatedAt
read-only
stringdate-time

Time of deactivation of the secret version

id
read-only
integer

Secret version

state
read-only
SecretStateEnum

State of the secret version

ValuesACTIVEDEACTIVATEDDELETED
400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000, path = string, version = 0

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secret/{path}/version/{version} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "createdAt": "2024-01-01T12:00:00Z", "deactivatedAt": "2024-01-01T12:00:00Z", "id": 0, "state": "ACTIVE"}

Get the secret configurationProduction

GET
/v2/okms/resource/{okmsId}/secretConfig

Returns the service-level defaults applied to new secrets: casRequired, maxVersions and deactivateVersionAfter.

Path parameters

okmsId
required
stringuuid

Okms ID

Response

200Responsesuccessful operation
casRequired
read-only
boolean

If set to true, the Cas (Check And Set) parameter will be required and verified for each secret update

deactivateVersionAfter
read-only
string

Time duration before a version is deactivated. If 0s, default configuration (unlimited) is applied.

maxVersions
read-only
integer

The number of versions to keep. If 0, default configuration (10) is applied.

400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secretConfig \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "casRequired": true, "deactivateVersionAfter": "string", "maxVersions": 0}

Update the secret configurationProduction

PUT
/v2/okms/resource/{okmsId}/secretConfig

Updates the service-level defaults applied to new secrets. Existing secrets keep the metadata they were created with.

Path parameters

okmsId
required
stringuuid

Okms ID

Request body (required)

casRequired
boolean

If set to true, the Cas (Check And Set) parameter will be required and verified for each secret update

deactivateVersionAfter
string

Time duration before a version is deactivated. If 0s, default configuration (unlimited) is applied.

maxVersions
integer

The number of versions to keep. If 0, default configuration (10) is applied.

Response

200Responsesuccessful operation
casRequired
read-only
boolean

If set to true, the Cas (Check And Set) parameter will be required and verified for each secret update

deactivateVersionAfter
read-only
string

Time duration before a version is deactivated. If 0s, default configuration (unlimited) is applied.

maxVersions
read-only
integer

The number of versions to keep. If 0, default configuration (10) is applied.

400objectError 400 response

Example uses okmsId = 00000000-0000-0000-0000-000000000000

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/secretConfig \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "casRequired": true, "deactivateVersionAfter": "string", "maxVersions": 0}