Configure IP allowlists for secure Klarna API access from your infrastructure.
13 min read
To enhance the security of API integrations, Klarna supports IP address restriction, allowing partners to define an allow-list of IP addresses from which requests are permitted. All requests originating from outside the defined list will be blocked.
Partners can specify up to 100 CIDR-blocks, each possibly covering multiple IPs, including both IPv4 and IPv6 formats, as part of this restriction policy. When enabled, Klarna validates every incoming API request against the configured IP list.
Setup IP address restrictions
Enhance API security by restricting access to your Klarna API integration to approved source IP ranges. Start in reporting mode to validate your configuration, then enable enforcement to block traffic from IPs that aren’t on your allowlist.
This article is intended for Partners integrating with Klarna using Klarna API integration.
Overview
Scope: Account-level IP allowlist for inbound API traffic to Klarna Network v2.
Modes:
NOT_ENABLED: The IP restrictions feature is not enabled.
REPORTING: Requests are allowed, and responses include the Klarna-Ip-Validation-Status header.
ENFORCED: Requests from IPs not on your allowlist are blocked. The header is no longer included.
Limits: Up to 100 CIDR entries (IPv4 and/or IPv6) per Klarna account.
Propagation: Changes and enforcement take up to 5 minutes to take effect.
How it works
You configure an account-level allowlist of source IP ranges in CIDR notation.
While in reporting mode, every API response includes Klarna-Ip-Validation-Status with one of the following values:
ALLOWED: The request originated from an IP on the allowlist.
DENIED: The request originated from an IP that isn’t on the allowlist.
INVALID: A technical error occurred during IP validation. Contact your standard Partner support channel.
After you confirm the allowlist is correct, enable enforcement so requests from IP's not on the allowlist are blocked.
Prerequisites
API credentials authorized to manage account integration settings.
A complete and accurate list of your systems’ public, egress IPs (both IPv4 and IPv6 as applicable).
A change plan and a maintenance window (recommended), because enforcement begins at the configured time and takes up to 5 minutes to propagate.
Endpoints
IP Allowlist management
PUT /v2/account/integration/inbound-restrictions/ip/allowlist — Add or overwrite the allowlist with new values.
POST /v2/account/integration/inbound-restrictions/ip/allowlist — Extend the allowlist.
GET /v2/account/integration/inbound-restrictions/ip/allowlist — List all configured allowed IP ranges.
GET /v2/account/integration/inbound-restrictions/ip — Read current IP-restriction enforcement status.
Implement IP address restrictions
By default, IP address restrictions are NOT_ENABLED. Start by enabling REPORTING mode explicitly:
Set enforcement_mode to REPORTING via PATCH /v2/account/integration/inbound-restriction/ip.
1) Start in reporting mode
After enabling reporting mode, the responses to the subsequent requests include the Klarna-Ip-Validation-Status header with DENIED status because the IP allowlist is empty.
You might need to add a new IP to the already configured allow list. This can be done using the POST endpoint for /v2/account/integration/inbound-restrictions/ip/allowlist.
The request body is a list of IP's the you wish to append to the existing IP list. The response contains the complete list of configured IP allowlist.
Note: This endpoint can be used in either of the modes, ENFORCED or REPORTING.
The IP endpoint manages the enforcement state of your IP allowlist restrictions through a state machine with three modes: NOT_ENABLED, REPORTING, and ENFORCED. This endpoint allows you to transition between these states with fine-grained control over when enforcement takes effect.
Enforcement modes
NOT_ENABLED — IP allowlist validation is completely disabled. No restrictions are applied, and requests from any IP address are accepted. No status header is returned.
REPORTING — IP allowlist validation is enabled but not enforced. Requests are validated against the allowlist, but violations are only logged—requests are still accepted. This mode is ideal for testing your allowlist configuration before enforcement.
ENFORCED — IP allowlist validation is fully enforced. Only requests originating from IP addresses in your allowlist are accepted. Requests from unlisted IP addresses are rejected.
Request parameters
Parameter
Type
Required
Description
enforcement_mode
string
Yes
Target enforcement mode: NOT_ENABLED, REPORTING, or ENFORCED
enforcement_type
string
Conditional
When transitioning to ENFORCED: NOW (immediate) or SCHEDULED (future date)
enforced_from
string (ISO 8601)
Conditional
Required when enforcement_type is SCHEDULED. Must be a future timestamp
Understanding the enforcement_mode Parameter
Critical Concept: The enforcement_mode in your request body represents your intention — what enforcement state you want to achieve. However, the actual enforcement state in the response depends on the current status (which is set by enforcement_type in the request):
enforcement_type: NOW: Transitions immediately. The response enforcement_mode will match your requested mode.
enforcement_type: SCHEDULED: Transitions at the specified future time. The response enforcement_mode will be REPORTING (transition pending) until the enforced_from timestamp is reached, at which point it becomes ENFORCED.
Example
JAVA
1
2
3
4
5
6
7
8
9
10
// Request: Client intends to enforce IP restrictions
{
"enforcement_mode": "ENFORCED",
"enforcement_type": "SCHEDULED",
"enforced_from": "2099-01-01T00:00:00Z"
}
// Response: Server acknowledges intention but keeps REPORTING until scheduled time
{
"enforcement_mode": "REPORTING",
This design provides a grace period where you can monitor the response status header Klarna-Ip-Validation-Status before enforcement activates, ensuring your allowlist is configured correctly.
Enforcement mode transitions
The endpoint provides 9 state transition combinations, each with distinct behavior:
1. NOT_ENABLED → REPORTING
Behavior: Enables IP validation in monitoring mode. All requests are processed normally, but response headers indicate whether the source IP falls within your configured CIDR block/s.
Use Case: First step in enabling IP restrictions. Monitor response headers to verify the status to be ALLOWED.
Behavior: Stops blocking the requests but continues indicating validation status in response headers. This transition removes any configured enforcement timestamp.
Behavior: Disable IP restriction feature. Stops blocking the requests and the status header is not included in the response. This transition removes any configured enforcement timestamp.
Behavior: Disables IP restriction feature. Response headers no longer indicate IP validation status. This transition removes any configured enforcement timestamp.
Use Case: Rollback or permanently disable IP restriction feature.
Behavior: This transition is blocked. It is not possible to directly go from NOT_ENABLED to ENFORCED.
Motivation: This action is not allowed in order to make sure that the transition is done safely through the verification of the status headers returned during the reporting mode.
Use the two-step approach here:
1.
First: NOT_ENABLED → REPORTING
2.
Then: REPORTING → ENFORCED
7. NOT_ENABLED → NOT_ENABLED
Behavior: No change. IP validation remains disabled.
Use Case: Confirming current state or idempotent operations.
Behavior: Maintains current monitoring mode. No functional change.
Use Case: Idempotent operations or confirming current state.
Important Limitation: You cannot schedule future enforcement while staying in REPORTING mode. To schedule enforcement, you must transition to ENFORCED mode (see transition #6).
// ❌ This will return 400 error
{
"enforcement_mode": "REPORTING",
"enforcement_type": "SCHEDULED",
"enforced_from": "2026-02-01T00:00:00Z"
}
Why This Fails: REPORTING mode means "monitor only, don't block." Scheduling is about when to start blocking, so it requires enforcement_mode: "ENFORCED" to express that intention.
9. ENFORCED → ENFORCED
Behavior: No change. IP validation enforcement is active.
Use Case: Resend the same request with enforcement_type set to NOW
JAVA
1
2
3
4
5
6
7
8
9
10
// Request, enforcement_type accepts only NOW
{
"enforcement_mode": "ENFORCED",
"enforcement_type": "NOW"
}
// Response
{
"enforcement_mode": "ENFORCED",
"enforced_from": "<timestamp-in-ISO>"
IP address restriction flow diagram
flowchart LR
%% ================= LEFT FLOW =================
subgraph ENF["IP Allowlist Enforcement State"]
direction TB
START((Start)):::tertiaryEntity
NOT_ENABLED["NOT_ENABLED
(no validation)"]:::tertiaryEntity
REPORTING["REPORTING
(validate only)"]:::secondaryEntity
SCHEDULED["ENFORCEMENT SCHEDULED
(pending transition)"]:::primaryEntity
ENFORCED["ENFORCED
(enforced)"]:::primaryEntity
START --> NOT_ENABLED
NOT_ENABLED --> REPORTING
REPORTING --> ENFORCED
REPORTING --> SCHEDULED
SCHEDULED --> ENFORCED
ENFORCED --> REPORTING
REPORTING --> NOT_ENABLED
ENFORCED --> NOT_ENABLED
end
%% ================= RIGHT FLOW =================
subgraph REQ["Request Behaviour"]
direction TB
R_NE["NOT_ENABLED
All requests allowed"]:::tertiaryEntity
R_RP["REPORTING
Requests allowed
Validation only"]:::secondaryEntity
R_EF["ENFORCED
Only allowlisted IPs allowed"]:::primaryEntity
R_NE --> R_RP --> R_EF
end
%% ================= STATE ↔ BEHAVIOUR MAPPING =================
NOT_ENABLED --- R_NE
REPORTING --- R_RP
ENFORCED --- R_EF
IP address format requirements
When configuring the allowlist, all entries must meet these requirements.
General requirements
CIDR notation is required (for example, 1.1.1.0/24 or 2001:4860::/32).
Single IPs must use the maximum prefix: /32 for IPv4 or /128 for IPv6.
Examples: 8.8.8.8/32, 2001:4860:4860::8888/128
Only valid IP addresses are accepted (no hostnames).
Empty strings or whitespace-only values aren’t permitted.
IPv4 requirements
Octets: Each of the 4 octets must be a decimal number between 0–255.
Keep a complete inventory of all outbound egress IPs used by your systems and automation.
Do not use dynamic IPs for your outbound traffic that may change without notice.
Log and monitor:
In reporting mode, capture Klarna-Ip-Validation-Status response header to identify gaps before enforcement.
Post-enforcement, monitor blocked-traffic signals on your side.
Plan change windows for enforcement updates to reduce risk of accidental lockouts.
Troubleshooting
Klarna-Ip-Validation-Status: DENIED
The source IP isn’t on the allowlist. Add the IP/CIDR, validate in reporting mode, then re-enforce.
Klarna-Ip-Validation-Status: INVALID
A technical error occurred during IP validation. Contact your standard Partner support channel.
Updates to the allowlist rejected while enforced
Disable enforcement to remove or replace entries.
Use the append-endpoint to extend the currently allowed IPs
No immediate effect after change.
Allow up to 5 minutes for changes to propagate.
Frontend vs. backend responsibilities
This feature is backend-only. Configure and operate IP address restrictions in your backend deployment and network egress layer. No frontend changes are required.