Get Metrics
GET /obp/v7.0.0/management/metrics
OBPv6.0.0-getMetrics Roles: CanReadMetrics MetricAPI
Get API metrics rows. These are records of each REST API call.
require CanReadMetrics role
NOTE: Automatic from_date Default
If you do not provide a from_date parameter, this endpoint will automatically set it to:
now - 9 minutes ago
This prevents accidentally querying all metrics since Unix Epoch and ensures reasonable response times.
For historical/reporting queries, always explicitly specify your desired from_date.
IMPORTANT: Smart Caching & Performance
This endpoint uses intelligent two-tier caching to optimize performance:
Stable Data Cache (Long TTL):
- Metrics older than 600 seconds (10 minutes) are considered immutable/stable
- These are cached for 86400 seconds (24 hours)
- Used when your query's from_date is older than the stable boundary
Recent Data Cache (Short TTL):
- Recent metrics (within the stable boundary) are cached for 7 seconds
- Used when your query includes recent data or has no from_date
STRONGLY RECOMMENDED: Always specify from_date in your queries!
Why from_date matters:
- Queries WITH from_date older than 10 mins → cached for 24 hours (fast!)
- Queries WITHOUT from_date → cached for only 7 seconds (slower)
Examples:
from_date=2025-01-01T00:00:00.000Z→ Uses 24 hours cache (historical data)from_date=1100-01-01T01:01:01.000Z(recent date) → Uses 7 seconds cache (recent data)- No from_date → Automatically set to 9 minutes ago → Uses 7 seconds cache (recent data)
For best performance on historical/reporting queries, always include a from_date parameter!
Filters Part 1.filtering (no wilde cards etc.) parameters to GET /management/metrics
You can filter by the following fields by applying url parameters
eg: /management/metrics?from_date=1100-01-01T01:01:01.000Z&to_date=1100-01-01T01:01:01.000Z&limit=50&offset=2
1 from_date e.g.:from_date=1100-01-01T01:01:01.000Z DEFAULT: If not provided, automatically set to now - 9 minutes (keeps queries in recent data zone) IMPORTANT: Including from_date enables long-term caching for historical data queries!
2 to_date e.g.:to_date=1100-01-01T01:01:01.000Z Defaults to a far future date i.e. Sat Jan 01 00:00:00 UTC 4000
3 limit (for pagination: defaults to 50) eg:limit=200
4 offset (for pagination: zero index, defaults to 0) eg: offset=10
5 sort_by (defaults to date field) eg: sort_by=date possible values: "url", "date", "username" (or "user_name" for backward compatibility), "app_name", "developer_email", "implemented_by_partial_function", "implemented_in_version", "consumer_id", "verb"
6 direction (defaults to date desc) eg: direction=desc
eg: /management/metrics?from_date=1100-01-01T01:01:01.000Z&to_date=1100-01-01T01:01:01.000Z&limit=10000&offset=0&anon=false&app_name=TeatApp&implemented_in_version=v2.1.0&verb=POST&user_id=c7b6cb47-cb96-4441-8801-35b57456753a&username=susan.uk.29@example.com&consumer_id=78
Other filters:
7 consumer_id (if null ignore)
8 user_id (if null ignore)
9 anon (if null ignore) only support two value : true (return where user_id is null.) or false (return where user_id is not null.)
10 url (if null ignore), note: can not contain '&'.
11 app_name (if null ignore)
12 implemented_by_partial_function (if null ignore),
13 implemented_in_version (if null ignore)
14 verb (if null ignore)
15 correlation_id (if null ignore)
16 duration (if null ignore) - Returns calls where duration > specified value (in milliseconds). Use this to find slow API calls. eg: duration=5000 returns calls taking more than 5 seconds
17 consent_reference_id (if null ignore) - Returns calls authenticated via the consent with this reference id. eg: consent_reference_id=fd13b9af-4f74-4d52-a7f1-7c2c12f3aa11
18 certificate_trust (if null ignore) - Returns calls by how the caller's certificate was established: direct (the TLS peer was the caller), forwarded (a trusted proxy forwarded the caller's certificate) or none (certificate material was present but no caller was identified). eg: certificate_trust=forwarded
19 domain_api_url (if null ignore) - Returns calls made under a Domain API whose called URL (the metric's domain_api_url) starts with this value: a base path gives every call through that Domain API, a longer value the calls to one of its paths. eg: domain_api_url=/carbon-registry/v1/
User Authentication is Required. The User must be logged in. The Application must also be authenticated.
JSON response body fields (24)
- api_instance_id
- api_instance_id
- app_name
- appNameBank
- consumer_id
- 7uy8a7e4-6d02-40e3-a129-0b2bf89de8uh
- correlation_id
- 1flssoftxq0cr1nssr68u0mioj
- date
- 2020-01-27
- developer_email
- duration
- 5.123
- forwarded_for
- forwarded_for
- implemented_by_partial_function
- implemented_in_version
- metrics
- operation_id
- OBPv6.0.0-getBanks
- response_body
- response_body
- source_ip
- source_ip
- status_code
- status_code
- target_ip
- target_ip
- url
- http://www.example.com/id-docs/123/image.png
- user_id
- 9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1
- username
- felixsmith
- verb
- auth_type
- auth_type
- certificate_trust
- certificate_trust
- certificate_trust_detail
- certificate_trust_detail
- consent_reference_id
- fd13b9af-4f74-4d52-a7f1-7c2c12f3aa11
Example success response
{
"metrics": [
{
"user_id": "9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
"url": "www.openbankproject.com",
"date": "1100-01-01T00:00:00Z",
"username": "OBP",
"app_name": "SOFI",
"developer_email": "felixsmith@example.com",
"implemented_by_partial_function": "getBanks",
"implemented_in_version": "v210",
"consumer_id": "123",
"verb": "get",
"correlation_id": "v8ho6h5ivel3uq7a5zcnv0w1",
"duration": 39,
"source_ip": "198.51.100.42",
"target_ip": "198.51.100.42",
"forwarded_for": "198.51.100.42, 10.0.0.2, 10.0.0.3",
"response_body": {
"code": 401,
"message": "OBP-20001: User not logged in. Authentication is required!"
},
"status_code": 401,
"operation_id": "OBPv4.0.0-getBanks",
"api_instance_id": "obp_node_a",
"consent_reference_id": "fd13b9af-4f74-4d52-a7f1-7c2c12f3aa11",
"auth_type": "Consent",
"certificate_trust": "forwarded",
"certificate_trust_detail": "cn=nginx-prod-1,ou=edge,o=tesobe gmbh,c=de"
}
]
}Possible errors (3)
- OBP-20001: User not logged in. Authentication is required!
- OBP-20006: User is missing one or more roles:
- OBP-50000: Unknown Error.