Authorize
Summary
Authorize is our implementation of the OAuth 2.0 framework. It enables secure authorization using standard methods that can easily be integrated in your app. If you're familiar with OAuth 2.0, everything should look familiar. If not, you may want to check out the OAuth 2.0 resources here.
Want to try this API out on our Playground?
Go play nowpost /clientCredentials/oauth2/token/us/gcb | Client Credentials grant: Retrieve access token |
get /authCode/oauth2/authorize | Authorization code grant: Retrieve authorization code |
post /authCode/oauth2/token/us/gcb | Authorization code grant: Retrieve access token |
post /authCode/oauth2/refresh | Authorization code grant: Refresh access token |
post /authCode/oauth2/revoke | Authorization code grant: Revoke access |
Client Credentials grant: Retrieve access token
Get access token for your application credentials. You can use this for APIs which do not require customer credential verification and consent (e.g. Onboarding).
- cURL
- Ruby
- Python
- PHP
- Java
- Node
- Go
- Swift
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
-
access_token
- Mandatory. The access token value received after exchanging the authorization token. This field should be passed as Authorization header in API request calls
- type : string
-
refresh_token
- Mandatory. You can use this token to refresh an expired access_token.
- type : string
-
scope
- Mandatory. Set of scopes allowed by customer and separated by space
- type : string
-
token_type
- Mandatory. Type of the access token issued. This is bearer token for authorization_code grant type
- type : string
-
expires_in
- Mandatory. Validity of access token in seconds
- type : number
error |
invalid_request |
invalid_grant |
unsupported_grant_type |
unauthorized_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
error |
invalid_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
Authorization code grant: Retrieve authorization code
To retrieve an authorization code, call the authorize endpoint by passing the required query parameters.You should end up with a relative URL similar to the below (illustrative).
/authCode/oauth2/authorize?response_type=code&client_id=[Your client_id issued to you during app registration]&scope=[Space delimited scopes selected from the table below. Only request the scopes required for your app to work.]&countryCode=US&businessCode=GCB&locale=en_US&state=[The state value you create and will verify]&redirect_uri=[The redirect_uri you registered during app registration].
Your final URL should look similar to this, go ahead a try it in any browser if you are unsure if you formed it properly:
https://sandbox.apihub.citi.com/gcb/api/authCode/oauth2/authorize?response_type=code&client_id=97086fae-c252-4d81-b4d9-d73cde5ea800&scope=accounts_details_transaction&countryCode=US&businessCode=GCB&locale=en_US&state=12093&redirect_uri=https://www.test.com
Scope | Description |
---|---|
customers_profiles | Provides customer name, email, phone number, and address |
accounts_routing_number | Adding clear account/routing number added to accounts API |
accounts_statements | Retrieve user account statements for customer |
accounts_tax_statements | Retrieve tax documentation for customer |
Once credentials are verified, a consent page will be presented to the Citi customer to approve the scope requested by your app. After getting customer consent, the flow redirects to the provided redirect_uri and an authorization code will be sent back as a query component.
https://www.test.com/?code=AAJP_jIlIuuIqS-qj0ohfXLaOyhQK9y4bbyhEJWt39l5gWT-1XZmCHtESO2gcbLsPmLlERAAPj80IfLueI4WM8s_Ay1Gy8VtcwFUv8lQE4Svi9hOayu5kBP2OKLhvBwMwrZ_wz5SDHaKN96BdgScYmNEGww0IcV5gH4VBjeOPijN7CxdMRwc2H_w5RnpckbCtS4605BCp5FD0Qho4tYsfcmJ&state=12093
This authorization code is valid for a very short period of time and should be immediately exchanged for access token.
- cURL
- Ruby
- Python
- PHP
- Java
- Node
- Go
- Swift
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
field name | field type | mandatory | description |
redirect_uri | location | yes | This is the absolute uri provided in the request |
code | query | yes | The authorization code |
state | query | yes | The same value as sent by the client in the state parameter, if any |
If an error occurs during authorization, two situations can occur. The first is, that the client is not authenticated or recognized. For instance, a wrong redirect URI was sent in the request. In that case the authorization server must not redirect the resource owner to the redirect URI. Instead it should inform the resource owner of the error. The second situation is that client is authenticated correctly, but that something else failed. In that case the following error response is sent to the client, included in the redirect_uri
field name | field type | mandatory | description |
redirect_uri | location | yes | This is the absolute uri provided in the request |
state | query | yes | The same value as sent by the client in the state parameter, if any |
error | query | yes | |
error_description | query | no | |
error_uri | query | no |
Here is the list of errors:
error |
invalid_request |
unauthorized_client |
unsupported_response_type |
invalid_scope |
access_denied |
Authorization code grant: Retrieve access token
Get an access token issued by calling our token endpoint and passing the authorization code from the previous call. The issued access token will have an expiry, and it will be valid only for the scope for which the consent has been provided by the customer. You can call the APIs by passing this token in Authorization header.
You also get a refresh token that can be used to get a new access token in case the original one expires.
- cURL
- Ruby
- Python
- PHP
- Java
- Node
- Go
- Swift
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
-
access_token
- Mandatory. The access token value received after exchanging the authorization token. This field should be passed as Authorization header in API request calls
- type : string
-
refresh_token
- Mandatory. You can use this token to refresh an expired access_token.
- type : string
-
scope
- Mandatory. Set of scopes allowed by customer and separated by space
- type : string
-
token_type
- Mandatory. Type of the access token issued. This is bearer token for authorization_code grant type
- type : string
-
expires_in
- Mandatory. Validity of access token in seconds
- type : number
error |
invalid_request |
invalid_grant |
unsupported_grant_type |
unauthorized_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
error |
invalid_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
Authorization code grant: Refresh access token
If your access token has expired and you still have a valid refresh token, you can exchange it for a new set of valid access and refresh tokens.
{
"default": "4468adf1-adfe-4f85-a2c1-f29beaa1f6ee"
}
- cURL
- Ruby
- Python
- PHP
- Java
- Node
- Go
- Swift
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
-
access_token
- Mandatory. This field should be passed as Authorization header in API request calls
- type : string
-
refresh_token
- Mandatory. The refresh token value
- type : string
-
scope
- Mandatory. The list of scopes separated by space
- type : string
-
token_type
- Mandatory. The token type
- type : string
-
expires_in
- Mandatory. The access token expiry time (in seconds)
- type : number
error |
invalid_request |
invalid_grant |
unsupported_grant_type |
unauthorized_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
error |
invalid_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
Authorization code grant: Revoke access
The revoke call will terminate the access granted by citi customer to your application.
- cURL
- Ruby
- Python
- PHP
- Java
- Node
- Go
- Swift
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
Example Request
-
status
- Optional. The status of the token revocation request.
- type : string
error |
invalid_request |
invalid_grant |
unauthorized_client |
unsupported_grant_type |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}
error |
invalid_client |
-
error_description
- Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred
- type : string
-
error
- Mandatory. If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.
- type : string
- enum : invalid_request, unauthorized_client, access_denied, unsupported_response_type, invalid_scope, server_error, temporarily_unavailable, unsupported_token_type
-
error_uri
- A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
- type : string
-
required
- error
{
"properties": {
"error_description": {
"description": "Human-readable ASCII [USASCII] text providing additional information, used to assist the client developer in understanding the error that occurred",
"type": "string"
},
"error": {
"description": "Mandatory.\n\n If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.",
"type": "string",
"enum": [
"invalid_request",
"unauthorized_client",
"access_denied",
"unsupported_response_type",
"invalid_scope",
"server_error",
"temporarily_unavailable",
"unsupported_token_type"
]
},
"error_uri": {
"description": "A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.",
"type": "string"
}
},
"required": [
"error"
]
}