Getting started
Concepts
- Model concepts
- API concepts
- API versions
- Entitlements
- Filters
- Request parameters
- Usage quota
- Error codes
Services
Parameters
- after
- aggregate
- aggregateIncrementFrom
- cursor
- dateFormat
- descending
- entity
- envelope
- fields
- format
- from
- groupBy
- groupById
- groupByIdAndTime
- groupByTo
- includeMetaData
- inline
- inlineLatest
- inlineTimeseries
- limit
- modulus
- nextUrl
- part
- pivot
- rankBy
- requestTimeout
- returnPreSignedUrl
- showMessage
- showStreamCursor
- to
- trace
- verifyLinks
- wait
Deprecated parameters
Datasets
- ECR: timeseries and observations
- ECR: usage patterns
- fiindices: retrieving index data
- Parsing: asset classes
- Parsing: best practices
Samples
Authentication
Every request for data must carry credentials. There are two ways to authenticate:
- an API key, obtained with your username and password and sent as a bearer token, or
- Single Sign-On (SSO) in a browser, with multi-factor authentication (MFA) for federated login.
Obtaining an API key
Call the authentication service with a POST request. Send username and password in the request body, with the Content-Type header set to application/x-www-form-urlencoded.
- URL:
https://consumer.qa.data.spglobal.com/apikey - Method:
POST
curl -X POST https://consumer.qa.data.spglobal.com/apikey -d username=USERNAME -d password=PASSWORD
The response body is the API key as plain text. Add format=JSON (or XML) to receive it in a structure: {"authToken":"..."}.
Note: Send the username and password in the request body only. Credentials in the URL query string are accepted today, but they are written to logs and future versions of the API can reject them.
Using the API key
Send the key in an Authorization header as a Bearer token with every request except the request for the key:
Authorization: Bearer APIKEY
For example, with curl:
curl -H "Authorization: Bearer APIKEY" "https://consumer.qa.data.spglobal.com/namespace/Entity/latest?limit=3"
The apiKey query parameter is disabled by default and is rejected. See apiKey.
Tip: Web browsers cannot add headers to a link. When you sign in on the HTML pages of this application, the key is stored in a secure cookie that is used for requests from the browser.
Single Sign-On (SSO)
For interactive browser access, Single Sign-On (SSO) with multi-factor authentication (MFA) is supported for federated login (external users).
- URL:
https://consumer.qa.data.spglobal.com/auth/login - Method:
GET
Add an optional redirect query parameter to return to a specific page after sign-in (defaults to /meta?format=HTML). After authenticating with the identity provider, the session key is stored in a secure cookie for subsequent browser requests.
Lifetime of an API key
An API key stays valid while you use it, and becomes invalid when:
- it is not used for a period of time (currently 15 minutes),
- you exceed the number of sessions allowed for your account (the oldest session is then invalidated), or
- the server limits the maximum age of a key.
Important: An application must work on the assumption that an API key can become invalid at any time. When a request fails because the key is invalid, obtain a new key and retry the request once. See Error codes: an invalid key is reported with error code
INVALID_API_KEY.
Reuse a key for as long as it is valid, in all threads and processes of your application. If your application creates keys more than about once per hour per process, this indicates a problem, such as several processes competing for the number of keys allowed for the account.
Limits and failures
- Every call to the authentication service takes at least one second.
- Too many parallel login requests, too many failed login attempts, or exceeding the number of sessions for your account is reported with HTTP status 429. Wait before you retry; do not retry in a tight loop.
- Wrong credentials are reported with HTTP status 400 and error code
INVALID_USERNAME_OR_PASSWORD. Do not retry with the same credentials.
Ending a session
To invalidate a key explicitly, send a POST request to https://consumer.qa.data.spglobal.com/apikey/logout with the key.