Ana içeriğe geç

Import JWK File

Endpoint​

POST /apiops/projects/{projectName}/jwks/import-file/
Info

This uploads the raw document. To restore a JWK from an Apinizer package, use the Import Objects endpoint with type CERTIFICATE.

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typemultipart/form-dataYes

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Form Fields​

FieldTypeRequiredDescription
jwkFilefileYesThe JWK or JWK Set JSON document
jwkNamestringYesName of the JWK to create
kidstringYesKey ID of the key to load from the document
jwkDescriptionstringNoDescription

Response​

Success Response (200 OK)​

{
"status": "SUCCESS"
}

When the JWK was stored but could not be deployed to its environments, the response says so:

{
"status": "SUCCESS",
"resultMessage": "JWK was saved successfully but deployment to environments failed. Details: ...",
"deploymentResult": {
"success": false,
"detailList": []
}
}

Error Response (400 Bad Request)​

{
"status": "FAILURE",
"resultMessage": "JWK (name: signing-jwk) is already exist!"
}

or

{
"status": "FAILURE",
"resultMessage": "kid value can not be empty!"
}

or

{
"status": "FAILURE",
"resultMessage": "jwkFile value can not be empty!"
}

Common Causes​

  • A JWK of that name already exists in the project
  • kid is missing, or names a key the document does not contain
  • The uploaded file is not a valid JWK or JWK Set document

Error Response (401 Unauthorized)​

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example​

Example 1: Upload a JWK Set​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/jwks/import-file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "jwkFile=@jwks.json" \
-F "jwkName=partner-jwk" \
-F "kid=partner-2026"

Example 2: Upload with a Description​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/jwks/import-file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "jwkFile=@jwks.json" \
-F "jwkName=partner-jwk" \
-F "kid=partner-2026" \
-F "jwkDescription=Partner signing key, rotated 2026-01"

Notes and Warnings​

  • kid selects the key: a JWK Set can carry several keys, so the key ID says which one is being registered. It is required even for a document holding a single key.
  • Same parsing as the clipboard endpoint: a file upload is only a different way in, never different semantics — the document is read exactly as Parse JWK from Clipboard reads it.
  • Names are unique per project: importing onto an existing name is rejected rather than silently creating a second JWK. Delete or rename the existing one first.
  • Public documents are fine: a JWK Set holding only public members registers normally, which is the usual shape when a partner sends you their keys.

Permissions​

  • User must have SECRETS + EXPORT_IMPORT permission in the project