Skip to content

Keys

All operations require authentication.

5 operationsv2/okms/resource
Agent setup

List service keysProduction

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

Returns the service keys of the service, with their metadata.

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

200ResponseWithIAM[]successful operation
alwaysSensitive
read-only
boolean

Whether the key has always been sensitive since creation

class
read-only
KeyClassEnum

Class of the key

ValuesKEY_PAIRPUBLIC_KEYSECRET_KEY
consumerCount
read-only
integer

Number of declared consumers

consumers
read-only
Consumer[]

List of declared consumers of the key

createdAt
read-only
stringdate-time

Creation time of the key

curve
read-only
KeyCurveEnum

Curve type for Elliptic Curve (EC) keys

ValuesP-256P-384P-521
extractable
read-only
boolean

Whether the key material can be extracted from the KMS

iam
read-only
ResourceMetadata

IAM resource metadata

id
read-only
stringuuid

Key ID

keys
read-only
JsonWebKeyResponse[]

The key in JWK format

keysPEM
read-only
PEM[]

The key in PEM format

name
read-only
string

Key name

neverExtractable
read-only
boolean

Whether the key has never been extractable at any point in its lifetime

operations
read-only
KeyOpsEnum[]

The operations for which the key is intended to be used

ValuesdecryptencryptsignunwrapKeyverifywrapKey
protectionLevel
read-only
KeyProtectionLevelEnum

Key protection level

ValuesHSMSOFTWARE
sensitive
read-only
boolean

Whether the key material can be exposed in plaintext. If true, extraction is only allowed in wrapped form.

size
read-only
KeySizeEnum

Size of the key

Values128192256384521204830724096
state
read-only
KeyStateEnum

State of the key

ValuesACTIVEALLCOMPROMISEDDEACTIVATEDDESTROYEDDESTROYED_COMPROMISEDPRE_ACTIVE
type
read-only
KeyTypeEnum

Key type

ValuesECRSAoct
400objectError 400 response

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

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/serviceKey \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
[ { "alwaysSensitive": true, "class": "KEY_PAIR", "consumerCount": 0, "consumers": [ { "additionalInfo": "string", "createdAt": "2024-01-01T12:00:00Z", "type": "string", "urn": "string" } ], "createdAt": "2024-01-01T12:00:00Z", "curve": "P-256", "extractable": true, "iam": { "displayName": "string", "id": "00000000-0000-0000-0000-000000000000", "state": "EXPIRED", "tags": { "key": "string" }, "urn": "string" }, "id": "00000000-0000-0000-0000-000000000000", "keys": [ { "alg": "ES256", "crv": "P-256", "d": "string", "dp": "string", "dq": "string", "e": "string", "k": "string", "key_ops": [ "decrypt" ], "kid": "string", "kty": "EC", "n": "string", "p": "string", "q": "string", "qi": "string", "use": "enc", "x": "string", "y": "string" } ], "keysPEM": [ { "pem": "string" } ], "name": "string", "neverExtractable": true, "operations": [ "decrypt" ], "protectionLevel": "HSM", "sensitive": true, "size": 128, "state": "ACTIVE", "type": "EC" }]

Create or import a service keyProduction

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

To create a new service key, omit the key material from the request. The KMS generates it from the type, size, curve and operations you specify.

To import an existing service key, supply its key material in the request. The key is stored in the KMS with the attributes you provide.

For a secure BYOK import, send the key material encrypted in wrappedKeys (RSA wrap) instead of in cleartext. The KMS unwraps it with the referenced transport key and stores the resulting service key.

Path parameters

okmsId
required
stringuuid

Okms ID

Request body (required)

context
string

Context of the key

curve
KeyCurveEnum

Curve type for Elliptic Curve (EC) keys

ValuesP-256P-384P-521
extractable
boolean

Whether the key material can be extracted from the KMS. Defaults to false.

keys
JsonWebKeyRequest[]

Set of JSON Web Keys in case of import, incompatible with type,size,curve and operations

name
string

Key name

operations
KeyOpsEnum[]

The operations for which the key is intended to be used

ValuesdecryptencryptsignunwrapKeyverifywrapKey
protectionLevel
KeyProtectionLevelEnum

Key protection level

ValuesHSMSOFTWARE
size
KeySizeEnum

Size of the key to be created

Values128192256384521204830724096
type
KeyTypeEnum

Type of the key to be created

ValuesECRSAoct

Response

200Responsesuccessful operation
alwaysSensitive
read-only
boolean

Whether the key has always been sensitive since creation

class
read-only
KeyClassEnum

Class of the key

ValuesKEY_PAIRPUBLIC_KEYSECRET_KEY
consumerCount
read-only
integer

Number of declared consumers

consumers
read-only
Consumer[]

List of declared consumers of the key

createdAt
read-only
stringdate-time

Creation time of the key

curve
read-only
KeyCurveEnum

Curve type for Elliptic Curve (EC) keys

ValuesP-256P-384P-521
extractable
read-only
boolean

Whether the key material can be extracted from the KMS

id
read-only
stringuuid

Key ID

keys
read-only
JsonWebKeyResponse[]

The key in JWK format

keysPEM
read-only
PEM[]

The key in PEM format

name
read-only
string

Key name

neverExtractable
read-only
boolean

Whether the key has never been extractable at any point in its lifetime

operations
read-only
KeyOpsEnum[]

The operations for which the key is intended to be used

ValuesdecryptencryptsignunwrapKeyverifywrapKey
protectionLevel
read-only
KeyProtectionLevelEnum

Key protection level

ValuesHSMSOFTWARE
sensitive
read-only
boolean

Whether the key material can be exposed in plaintext. If true, extraction is only allowed in wrapped form.

size
read-only
KeySizeEnum

Size of the key

Values128192256384521204830724096
state
read-only
KeyStateEnum

State of the key

ValuesACTIVEALLCOMPROMISEDDEACTIVATEDDESTROYEDDESTROYED_COMPROMISEDPRE_ACTIVE
type
read-only
KeyTypeEnum

Key type

ValuesECRSAoct
400objectError 400 response

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

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/serviceKey \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "alwaysSensitive": true, "class": "KEY_PAIR", "consumerCount": 0, "consumers": [ { "additionalInfo": "string", "createdAt": "2024-01-01T12:00:00Z", "type": "string", "urn": "string" } ], "createdAt": "2024-01-01T12:00:00Z", "curve": "P-256", "extractable": true, "id": "00000000-0000-0000-0000-000000000000", "keys": [ { "alg": "ES256", "crv": "P-256", "d": "string", "dp": "string", "dq": "string", "e": "string", "k": "string", "key_ops": [ "decrypt" ], "kid": "string", "kty": "EC", "n": "string", "p": "string", "q": "string", "qi": "string", "use": "enc", "x": "string", "y": "string" } ], "keysPEM": [ { "pem": "string" } ], "name": "string", "neverExtractable": true, "operations": [ "decrypt" ], "protectionLevel": "HSM", "sensitive": true, "size": 128, "state": "ACTIVE", "type": "EC"}

Get a service keyProduction

GET
/v2/okms/resource/{okmsId}/serviceKey/{keyId}

Returns one service key and its metadata. Pass optional format to also export the key material as JWK or PEM, when the key is extractable.

Path parameters

keyId
required
stringuuid

Key ID

okmsId
required
stringuuid

Okms ID

Query parameters

format
KeyFormatEnum

Optional additional output format of the key

ValuesJWKPEM

Response

200ResponseWithIAMsuccessful operation
alwaysSensitive
read-only
boolean

Whether the key has always been sensitive since creation

class
read-only
KeyClassEnum

Class of the key

ValuesKEY_PAIRPUBLIC_KEYSECRET_KEY
consumerCount
read-only
integer

Number of declared consumers

consumers
read-only
Consumer[]

List of declared consumers of the key

createdAt
read-only
stringdate-time

Creation time of the key

curve
read-only
KeyCurveEnum

Curve type for Elliptic Curve (EC) keys

ValuesP-256P-384P-521
extractable
read-only
boolean

Whether the key material can be extracted from the KMS

iam
read-only
ResourceMetadata

IAM resource metadata

id
read-only
stringuuid

Key ID

keys
read-only
JsonWebKeyResponse[]

The key in JWK format

keysPEM
read-only
PEM[]

The key in PEM format

name
read-only
string

Key name

neverExtractable
read-only
boolean

Whether the key has never been extractable at any point in its lifetime

operations
read-only
KeyOpsEnum[]

The operations for which the key is intended to be used

ValuesdecryptencryptsignunwrapKeyverifywrapKey
protectionLevel
read-only
KeyProtectionLevelEnum

Key protection level

ValuesHSMSOFTWARE
sensitive
read-only
boolean

Whether the key material can be exposed in plaintext. If true, extraction is only allowed in wrapped form.

size
read-only
KeySizeEnum

Size of the key

Values128192256384521204830724096
state
read-only
KeyStateEnum

State of the key

ValuesACTIVEALLCOMPROMISEDDEACTIVATEDDESTROYEDDESTROYED_COMPROMISEDPRE_ACTIVE
type
read-only
KeyTypeEnum

Key type

ValuesECRSAoct
400objectError 400 response

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

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/serviceKey/{keyId} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "alwaysSensitive": true, "class": "KEY_PAIR", "consumerCount": 0, "consumers": [ { "additionalInfo": "string", "createdAt": "2024-01-01T12:00:00Z", "type": "string", "urn": "string" } ], "createdAt": "2024-01-01T12:00:00Z", "curve": "P-256", "extractable": true, "iam": { "displayName": "string", "id": "00000000-0000-0000-0000-000000000000", "state": "EXPIRED", "tags": { "key": "string" }, "urn": "string" }, "id": "00000000-0000-0000-0000-000000000000", "keys": [ { "alg": "ES256", "crv": "P-256", "d": "string", "dp": "string", "dq": "string", "e": "string", "k": "string", "key_ops": [ "decrypt" ], "kid": "string", "kty": "EC", "n": "string", "p": "string", "q": "string", "qi": "string", "use": "enc", "x": "string", "y": "string" } ], "keysPEM": [ { "pem": "string" } ], "name": "string", "neverExtractable": true, "operations": [ "decrypt" ], "protectionLevel": "HSM", "sensitive": true, "size": 128, "state": "ACTIVE", "type": "EC"}

Update a service keyProduction

PUT
/v2/okms/resource/{okmsId}/serviceKey/{keyId}

Updates the key's name or extractability.

You can also change the key state to activate, deactivate, or mark it as compromised. Deactivation requires deactivationReason.

A deactivated key keeps its material in the KMS and can be reactivated later.

Path parameters

keyId
required
stringuuid

Key ID

okmsId
required
stringuuid

Okms ID

Request body (required)

deactivationReason
KeyDeactivationReasonEnum

Key deactivation reason

ValuesAFFILIATION_CHANGEDCA_COMPROMISECESSATION_OF_OPERATIONKEY_COMPROMISEPRIVILEGE_WITHDRAWNSUPERSEDEDUNSPECIFIED
extractable
boolean

Whether the key material can be extracted from the KMS

name
string

Key Name

state
KeyStateUpdateEnum

Key desired state for activation, deactivation and compromise (specific case of deactivation)

ValuesACTIVECOMPROMISEDDEACTIVATED

Response

200Responsesuccessful operation
alwaysSensitive
read-only
boolean

Whether the key has always been sensitive since creation

class
read-only
KeyClassEnum

Class of the key

ValuesKEY_PAIRPUBLIC_KEYSECRET_KEY
consumerCount
read-only
integer

Number of declared consumers

consumers
read-only
Consumer[]

List of declared consumers of the key

createdAt
read-only
stringdate-time

Creation time of the key

curve
read-only
KeyCurveEnum

Curve type for Elliptic Curve (EC) keys

ValuesP-256P-384P-521
extractable
read-only
boolean

Whether the key material can be extracted from the KMS

id
read-only
stringuuid

Key ID

keys
read-only
JsonWebKeyResponse[]

The key in JWK format

keysPEM
read-only
PEM[]

The key in PEM format

name
read-only
string

Key name

neverExtractable
read-only
boolean

Whether the key has never been extractable at any point in its lifetime

operations
read-only
KeyOpsEnum[]

The operations for which the key is intended to be used

ValuesdecryptencryptsignunwrapKeyverifywrapKey
protectionLevel
read-only
KeyProtectionLevelEnum

Key protection level

ValuesHSMSOFTWARE
sensitive
read-only
boolean

Whether the key material can be exposed in plaintext. If true, extraction is only allowed in wrapped form.

size
read-only
KeySizeEnum

Size of the key

Values128192256384521204830724096
state
read-only
KeyStateEnum

State of the key

ValuesACTIVEALLCOMPROMISEDDEACTIVATEDDESTROYEDDESTROYED_COMPROMISEDPRE_ACTIVE
type
read-only
KeyTypeEnum

Key type

ValuesECRSAoct
400objectError 400 response

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

$ curl https://api.eu.ovhcloud.com/v2/okms/resource/{okmsId}/serviceKey/{keyId} \
  -H "authorization: Bearer $OVH_TOKEN"
ResponseExample
{ "alwaysSensitive": true, "class": "KEY_PAIR", "consumerCount": 0, "consumers": [ { "additionalInfo": "string", "createdAt": "2024-01-01T12:00:00Z", "type": "string", "urn": "string" } ], "createdAt": "2024-01-01T12:00:00Z", "curve": "P-256", "extractable": true, "id": "00000000-0000-0000-0000-000000000000", "keys": [ { "alg": "ES256", "crv": "P-256", "d": "string", "dp": "string", "dq": "string", "e": "string", "k": "string", "key_ops": [ "decrypt" ], "kid": "string", "kty": "EC", "n": "string", "p": "string", "q": "string", "qi": "string", "use": "enc", "x": "string", "y": "string" } ], "keysPEM": [ { "pem": "string" } ], "name": "string", "neverExtractable": true, "operations": [ "decrypt" ], "protectionLevel": "HSM", "sensitive": true, "size": 128, "state": "ACTIVE", "type": "EC"}

Delete a service keyProduction

DELETE
/v2/okms/resource/{okmsId}/serviceKey/{keyId}

Permanently deletes the key and its material from the KMS. Once deleted, the key cannot be recovered.

The key must already be deactivated, unless force is set.

Path parameters

keyId
required
stringuuid

Key ID

okmsId
required
stringuuid

Okms ID

Query parameters

force
boolean

Force deletion of the key

Response

200—successful operation

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

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