Authentication
Learn how to authenticate with Swift APIs
OAuth 2.0
Swift uses OAuth 2.0, an industry-standard protocol for authorisation. It operates through the exchange of tokens, which grant specific permissions to the client application. We will walk you through the steps to request, use and dispose of tokens.
Authorisation types
The authorisation type you need to use depends on the API product you are trying to access. You can find the corresponding authorisation type in the API documentation for the specific product.
There are two types of authorisation that you can use to access the Swift APIs:
- JWT Bearer Grant Type: The application uses a JSON Web Token (JWT) to request an access token from the Swift OAuth Token API, and in return, it receives an access token.
- Password Grant Type: The application sends the user's username and password to the Swift OAuth Token API, and in return, it receives an access token.
More information about the authorisation types can be found in the respective chapters.
Authorisation URLs
You can find in which environment the API is available in the API documentation for the specific API product you are trying to access.
Swift APIs are available through two different networks:
- MV-SIPN: The MV-SIPN (Multi-Vendor Service Interconnection and Protocol Network) is a private network that provides secure and reliable connectivity between Swift's clients and the Swift network.
- Internet: The Internet is a public network that provides connectivity between Swift's clients and the Swift network.
The following table shows the authorisation URLs for each environment:
| Environment | MV-SIPN | Internet |
|---|---|---|
| Sandbox | sandbox.swift.com/oauth2/v1 | sandbox.swift.com/oauth2/v1 |
| Pilot | api-test.swiftnet.sipn.swift.com/oauth2/v1 | api-pilot.swift.com/oauth2/v1 |
| Live | api.swiftnet.sipn.swift.com/oauth2/v1 | api.swift.com/oauth2/v1 |
Authorisation flow
The authorisation flow is as follows:
- The application requests an access token from the Swift OAuth Token API.
- The Swift OAuth Token API validates the request and returns an access token.
- The application uses the access token to make API requests.
When making API requests (step 3), you must include the access token in the Authorization header:
Authorization: Bearer <access-token>Before you start
Before you can authenticate with Swift APIs, you need to:
- Create an application - Register your application with Swift to obtain client credentials
- API access - Ensure you have the necessary permissions for the APIs you want to access
In the next sections, you will find detailed instructions on how to obtain these credentials and use them to authenticate with Swift APIs using either the JWT Bearer Grant Type or the Password Grant Type.