Skip to main content
Developer

Error Handling in BankID CSC Signing API#

View as Markdown
On this page

Overview#

The BankID CSC Signing API uses two different error response formats depending on the endpoint:

  • CSC endpoints (/credentials/*, /signatures/*, /info) return errors in CSC format.
  • OAuth endpoints (/oauth2/token, /oauth2/authorize) return errors in OAuth 2.0 format (RFC 6749).

CSC Endpoint Errors#

Error Response Format#

All CSC endpoint errors follow this JSON format:

{
    "errorCode": "error_code_here",
    "errorDescription": "Human-readable description of the error",
    "errorReference": "REF123456789"
}

errorCode: Error code classifying the problem (see table below).

errorReference: Unique reference to a particular error occurrence — please state this when contacting BankID support.

Error Codes#

Error CodeDescriptionHTTP StatusCategory
invalid_requestThe request is missing a required parameter, includes an invalid parameter value, or is otherwise malformed400Request Validation
invalid_parametersOne or more request parameters are invalid or missing400Request Validation
invalid_credential_idThe credential ID is invalid or not found400Request Validation
invalid_sadThe Signature Activation Data (SAD) is invalid400Request Validation
invalid_hash_algorithmThe hash algorithm is not supported400Request Validation
invalid_signature_formatThe signature format or algorithm is not supported400Request Validation
hash_mismatchThe number of hashes does not match numSignatures400Request Validation
document_too_largeThe request payload exceeds the maximum allowed size413Request Validation
token_already_usedThe access token has already been used at this endpoint. Each token must follow the required endpoint order exactly once400Token Lifecycle
authentication_requiredAuthentication is required to access this resource401Authentication
invalid_tokenThe access token is invalid, expired, or malformed401Authentication
insufficient_scopeThe access token does not have the required scope403Authorization
credential_not_foundThe specified credential was not found404Credential
credential_lockedThe credential is locked or suspended403Credential
credential_expiredThe credential has expired403Credential
certificate_not_foundThe certificate was not found404Credential
certificate_expiredThe certificate has expired403Credential
certificate_revokedThe certificate has been revoked403Credential
certificate_creation_failedCertificate generation failed during credential creation500Signing Backend
signing_limit_exceededThe signing limit has been exceeded403Signing
signature_validation_failedThe signature validation failed422Signing
unsupported_operationThe operation is not supported for this credential type501Signing
csc_service_errorError occurred while communicating with the signing backend500Service
csc_service_timeoutThe signing backend did not respond in time500Service
csc_service_unavailableThe signing backend is temporarily unavailable503Service
csc_user_keys_limitThe signing backend key generation limit has been reached. Retry after a short delay503Service
service_unavailableThe service is temporarily unavailable503Service
internal_errorAn internal server error occurred500Internal

How to Fix Errors? What to Do?#

How to react to errors depends on the category of the error.

Category 'Request Validation'

This is a request validation error due to missing or invalid parameter values. Fix the request according to the error description and try again. If the problem persists, contact BankID support.

Category 'Token Lifecycle'

The access token has been used out of order or reused at an endpoint. Each access token must follow the required endpoint sequence: credentials/list then credentials/authorize then signatures/signHash. If you receive token_already_used, you need to start a new signing session by obtaining a fresh access token. See Token single-use for details.

Category 'Authentication'

Use the correct token and authentication data and try again. If the problem persists, contact BankID support.

Category 'Authorization'

Ensure the access token has the required scope. If the problem persists, contact BankID support.

Category 'Credential'

The credential or certificate is not available, has expired, or has been revoked. Verify the credential ID and its status. If the problem persists, contact BankID support.

Category 'Signing Backend' and 'Signing'

These errors occur during the signing process. If the problem persists, contact BankID support.

Category 'Service'

The service or signing backend is temporarily unavailable. Retry after a short delay. For csc_user_keys_limit, the signing backend has reached its key generation capacity — retry after a brief wait. If the problem persists, contact BankID support.

Category 'Internal'

Technical problems. Contact BankID support.

OAuth Token Endpoint Errors#

Error Response Format#

Errors from POST /oauth2/token follow the OAuth 2.0 error format (RFC 6749):

{
    "error": "error_code_here",
    "error_description": "Human-readable description of the error"
}

Error Codes#

Error CodeDescriptionHTTP Status
invalid_requestThe request is missing a required parameter or includes an invalid parameter value400
invalid_clientClient authentication failed401
invalid_grantThe authorization code is invalid, expired, or the code_verifier does not match the code_challenge400
unauthorized_clientThe client is not authorized to use this grant type400
unsupported_grant_typeThe grant type is not supported400
server_errorThe server encountered an unexpected condition500
temporarily_unavailableThe service is temporarily unavailable503

OAuth Authorize Endpoint Errors#

Error Response Format#

Errors from GET /oauth2/authorize are delivered as query parameters in the redirect back to the redirect_uri:

https://your-redirect-uri?error=access_denied&error_description=User+denied+the+request&state=your-state

Error Codes#

Error CodeDescription
invalid_requestThe request is missing a required parameter or includes an invalid parameter value
access_deniedThe user denied the authorization request
unsupported_response_typeThe response type is not supported
invalid_scopeThe requested scope is invalid or unknown
server_errorThe server encountered an unexpected condition
temporarily_unavailableThe service is temporarily unavailable

Was this page helpful?