All API requests require an API key and an authorization token. See below for more information.
Our sandbox APIs are available to anyone wanting to test or develop their applications.
API products are tagged with current API lifecycle status (experimental, in development, in production, deprecated).
This sandbox is your environment to get to know about our APIs. It provides the same APIs as our production environment but with mock data.
Currently the sandbox environment is in beta stage, so some changes to the APIs and request header structure are subject to change.
Production environment and support
Once you have tested your business case in the Sandbox environment and feel confident that APIs here fulfil your needs, it’s time to move on to production.
Note that APIs have different classifications which directly correlate to lead time for getting the production keys – open data APIs have typically shorter lead times and regulated data APIs longer. This is simply due to legislative requirements.
Also note that you can only apply to APIs which are explicitly stated to being in production. Follow OP-Developer site and our newsletters to keep up to date on production status of our APIs.
We are currently developing our authentication flows for different use cases. You can read more from here.
At the moment most of the APIs the authentication is simulated with static tokens. You can pass along the x-authorization header with one of following tokens to get access to different end-user data:
All requests are made over https to ensure that request payload and headers are encrypted. Be aware that TLS 1.0 and 1.1 versions are nearing their end of life, so we strongly encourage you to use clients that support TLS version 1.2.
API Security Considerations For Production
Security requirements and mechanisms for a particular API depends on the risk level of the service and the confidentiality of the data processed.
Authentication and authorization requirements are set according to the risk levels as well.
As a minimum requirement, confidential data must be protected both in transit and in store.
Risk levels are evaluated and security levels and requirements are set accordingly, please see the table below.
|Security level||Access Control Requirements|
|High||The client app must be authenticated and authorized to use the API. Strong customer authentication methods are used to authenticate the end-user using the OIDC protocol. The end-user can also be subject to fine grained authorization within the API processing logic. TLS Mutual authentication and encryption is compulsory.|
|Substantial||The client app must be authenticated and authorized to use the API. Strong customer authentication of the end-user as well as end-user authorization is often required.|
|Basic||The client app must be registered and will be authenticated prior to granting access to the API. A user can be a technical user e.g. a system or a process and it must be authorized to use the API. Usually, there is no need to authenticate the end-user, though the user information can be relayed in the payload.|
|Open||Client application must be registered.|
Refer to the technical documentation of the API in question for detailed security implementation guidelines.
API's version is embedded in the URI: sandbox.apis.op-palvelut.fi/v1/accounts. The v1 part of the URI is the current major version for the API. When the next major version of the API is published the version number is increased by one e.g. sandbox.apis.op-palvelut.fi/v2/accounts. Backward compatibility between major API versions is not guaranteed and usually previous major version is deprecated when new version is published.
You should use these custom headers in your requests:
|x-api-key||a161-43ee-b222||(Required) Consumer application's API key|
|x-session-id||c38a-11e7-abc4||(Optional) Session identifier for in-memory data|
|x-request-id||string||(Optional) Request unique identifier (not validated at the moment)|
authentication||(Required) Token for end-user simulation|
Currently requests to all sandbox APIs are limited to 1000 requests / application / day. If the daily limit is reached the server responds with a HTTP status code 429 (see below) along with X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers, which tells the caller that the request limit has been reached.
If you feel that 1000 requests per day isn't enough for your developer application feel free to contact us, along with a description of your usage needs.
Normal operation of an API request is indicated in a response message by an HTTP status in the range of 200-399.
The list below summarizes HTTP normal operation status codes.
A successful retrieval or update operation
400 BAD REQUEST
The request contained invalid or missing request headers, parameters or payload. A retry of an identical request will not succeed.
Possible error conditions:
- Validation errors of headers or payload
- Missing or malformed content, invalid encoding etc.
Resource access requires user identification. Identity token is missing or invalid.
429 TOO MANY REQUESTS
Optional, used when a request is rejected due to rate limiting.
500 INTERNAL SERVER ERROR
A system error, specified in detail by the error data descriptor in the response payload.
Possible error conditions include:
- Runtime exception in a service
- Application server failure
- Unrecoverable technical exception
- Business level exception
503 SERVICE UNAVAILABLE
The service exists but it is temporarily unavailable, e.g. due to overload or maintenance. The application server instance is not accepting requests.
Sometimes the execution of an API call fails and the error situation must be handled. In these cases, the error situation is indicated by proper HTTP status code as defined in response status code listing. In addition to standard HTTP status codes, also custom consumable error descriptors are provided to the client as part of the response payload. The examples below show the structure of an error descriptor in JSON format which is the default format for REST APIs. The error descriptor might contain 1-n errors. If there is an error descriptor in the response, it is the only payload data available. The following table describes the error descriptor content.
|Id||yes||A unique identifier for the error event, for example UUID. Generated on the server side when the error occurs.|
|Level||yes||Error level can be FATAL, ERROR or WARN. For a FATAL, no retry is likely to succeed without server side maintenance measures. An ERROR may be temporary and the request may be retried later. A WARN level error indicates that as part of the request execution, something went wrong but the end result is ok.|
|Type||yes||Allowed error types are SECURITY, VALIDATION, TECHNICAL and BUSINESS. A BUSINESS type of an error message must include a business specific error code and a an optional detailed error code.|
|Message||yes||A textual description of the error condition.|
|Code||no||An error code defined by the application, for errors of type BUSINESS only.|
|DetailedConstraitViolations||no||Detailed map of validation fields and constraints that failed, for errors of type VALIDATION only.|
Error descriptor is attached to the response message payload as children of top-level element "errors" in the event of a server side error.
"message": "Account balance exceeded",