curl --request POST \
--url https://api.yapily.com/consent-auth-code \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"authCode": "6b965fbb-ff09-4afa-b897-90c34797cb8f",
"authState": "1270cb2ffc4842b78953afa2228e0a87"
}
'import requests
url = "https://api.yapily.com/consent-auth-code"
payload = {
"authCode": "6b965fbb-ff09-4afa-b897-90c34797cb8f",
"authState": "1270cb2ffc4842b78953afa2228e0a87"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
authCode: '6b965fbb-ff09-4afa-b897-90c34797cb8f',
authState: '1270cb2ffc4842b78953afa2228e0a87'
})
};
fetch('https://api.yapily.com/consent-auth-code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.yapily.com/consent-auth-code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'authCode' => '6b965fbb-ff09-4afa-b897-90c34797cb8f',
'authState' => '1270cb2ffc4842b78953afa2228e0a87'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.yapily.com/consent-auth-code"
payload := strings.NewReader("{\n \"authCode\": \"6b965fbb-ff09-4afa-b897-90c34797cb8f\",\n \"authState\": \"1270cb2ffc4842b78953afa2228e0a87\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.yapily.com/consent-auth-code")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"authCode\": \"6b965fbb-ff09-4afa-b897-90c34797cb8f\",\n \"authState\": \"1270cb2ffc4842b78953afa2228e0a87\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yapily.com/consent-auth-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"authCode\": \"6b965fbb-ff09-4afa-b897-90c34797cb8f\",\n \"authState\": \"1270cb2ffc4842b78953afa2228e0a87\"\n}"
response = http.request(request)
puts response.read_body{
"id": "56a42244-414a-4b52-8c4f-4ad2a50e82fe",
"userUuid": "ca412fdf-5a30-43a2-88b7-5964a24a8e55",
"applicationUserId": "string",
"institutionId": "modelo-sandbox",
"status": "AUTHORIZED",
"createdAt": "2021-06-08T10:59:35.138Z",
"featureScope": [
"ACCOUNT_BENEFICIARIES",
"ACCOUNT_STATEMENT_FILE",
"ACCOUNTS",
"ACCOUNT_PERIODIC_PAYMENTS",
"ACCOUNT_TRANSACTIONS",
"ACCOUNT",
"ACCOUNT_STATEMENTS",
"ACCOUNT_SCHEDULED_PAYMENTS",
"IDENTITY",
"ACCOUNT_DIRECT_DEBITS",
"ACCOUNT_STATEMENT",
"ACCOUNT_BALANCES",
"ACCOUNT_TRANSACTIONS_WITH_MERCHANT"
],
"consentToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJJTlNUSVRVVElPTiI6Im1vZGVsby1zYW5kYm94IiwiQ09OU0VOVCI6IjU2YTQyMjQ0LTQxNGEtNGI1Mi04YzRmLTRhZDJhNTBlODJmZSIsIkFQUExJQ0FUSU9OX1VTRVJfSUQiOiJtb2ZlLTIiLCJVU0VSIjoiY2E0MTJmZGYtNWEzMC00M2EyLTg4YjctNTk2NGEyNGE4ZTU1In0.gorwpnUjSr5dzQJLR32M2geWOj7yK9xMsZmq27ssY9xP_xGmWfUL_aqVHYyQ4r5KWw6Xb6RjvO839st8chJLtg",
"state": "a09f8ff9c1284444aa635267e05f76e1",
"authorizedAt": "2021-06-08T10:59:53.288Z",
"institutionConsentId": "aac-605d48f2-2a0e-4594-81a9-996524fa3b2a"
}{
"error": {
"code": 401,
"status": "UNAUTHORIZED",
"message": "Full authentication is required to access this resource"
}
}Exchange OAuth2 Code
Used to obtain a Yapily Consent object containing the consentToken once the user has authenticated and you have an OAuth2 authorisation code auth-code and state auth-state.
curl --request POST \
--url https://api.yapily.com/consent-auth-code \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"authCode": "6b965fbb-ff09-4afa-b897-90c34797cb8f",
"authState": "1270cb2ffc4842b78953afa2228e0a87"
}
'import requests
url = "https://api.yapily.com/consent-auth-code"
payload = {
"authCode": "6b965fbb-ff09-4afa-b897-90c34797cb8f",
"authState": "1270cb2ffc4842b78953afa2228e0a87"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
authCode: '6b965fbb-ff09-4afa-b897-90c34797cb8f',
authState: '1270cb2ffc4842b78953afa2228e0a87'
})
};
fetch('https://api.yapily.com/consent-auth-code', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.yapily.com/consent-auth-code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'authCode' => '6b965fbb-ff09-4afa-b897-90c34797cb8f',
'authState' => '1270cb2ffc4842b78953afa2228e0a87'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.yapily.com/consent-auth-code"
payload := strings.NewReader("{\n \"authCode\": \"6b965fbb-ff09-4afa-b897-90c34797cb8f\",\n \"authState\": \"1270cb2ffc4842b78953afa2228e0a87\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.yapily.com/consent-auth-code")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"authCode\": \"6b965fbb-ff09-4afa-b897-90c34797cb8f\",\n \"authState\": \"1270cb2ffc4842b78953afa2228e0a87\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yapily.com/consent-auth-code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"authCode\": \"6b965fbb-ff09-4afa-b897-90c34797cb8f\",\n \"authState\": \"1270cb2ffc4842b78953afa2228e0a87\"\n}"
response = http.request(request)
puts response.read_body{
"id": "56a42244-414a-4b52-8c4f-4ad2a50e82fe",
"userUuid": "ca412fdf-5a30-43a2-88b7-5964a24a8e55",
"applicationUserId": "string",
"institutionId": "modelo-sandbox",
"status": "AUTHORIZED",
"createdAt": "2021-06-08T10:59:35.138Z",
"featureScope": [
"ACCOUNT_BENEFICIARIES",
"ACCOUNT_STATEMENT_FILE",
"ACCOUNTS",
"ACCOUNT_PERIODIC_PAYMENTS",
"ACCOUNT_TRANSACTIONS",
"ACCOUNT",
"ACCOUNT_STATEMENTS",
"ACCOUNT_SCHEDULED_PAYMENTS",
"IDENTITY",
"ACCOUNT_DIRECT_DEBITS",
"ACCOUNT_STATEMENT",
"ACCOUNT_BALANCES",
"ACCOUNT_TRANSACTIONS_WITH_MERCHANT"
],
"consentToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJJTlNUSVRVVElPTiI6Im1vZGVsby1zYW5kYm94IiwiQ09OU0VOVCI6IjU2YTQyMjQ0LTQxNGEtNGI1Mi04YzRmLTRhZDJhNTBlODJmZSIsIkFQUExJQ0FUSU9OX1VTRVJfSUQiOiJtb2ZlLTIiLCJVU0VSIjoiY2E0MTJmZGYtNWEzMC00M2EyLTg4YjctNTk2NGEyNGE4ZTU1In0.gorwpnUjSr5dzQJLR32M2geWOj7yK9xMsZmq27ssY9xP_xGmWfUL_aqVHYyQ4r5KWw6Xb6RjvO839st8chJLtg",
"state": "a09f8ff9c1284444aa635267e05f76e1",
"authorizedAt": "2021-06-08T10:59:53.288Z",
"institutionConsentId": "aac-605d48f2-2a0e-4594-81a9-996524fa3b2a"
}{
"error": {
"code": 401,
"status": "UNAUTHORIZED",
"message": "Full authentication is required to access this resource"
}
}Authorizations
Use HTTP Basic Authentication with your Application ID as username and Application Secret as password. Manage credentials in the Yapily Console. See Authentication for details.
Body
Response
Ok
Consent detailing the requested authorisation from a user to a specific Institution.
Conditional. The user-friendly reference to the User that will authorise the authorisation request. If a User with the specified applicationUserId exists, it will be used otherwise, a new User with the specified applicationUserId will be created and used. Either the userUuid or applicationUserId must be provided.
Current status of the embedded authorisation request in code form.
AWAITING_AUTHORIZATION, AWAITING_FURTHER_AUTHORIZATION, AWAITING_RE_AUTHORIZATION, AUTHORIZED, CONSUMED, REJECTED, REVOKED, FAILED, EXPIRED, UNKNOWN, INVALID, AWAITING_DECOUPLED_PRE_AUTHORIZATION, AWAITING_PRE_AUTHORIZATION, PRE_AUTHORIZED, AWAITING_DECOUPLED_AUTHORIZATION, AWAITING_SCA_METHOD, AWAITING_SCA_CODE The set of features that the consent will provide access to.
Used to describe what functions are supported by the associated Institution.
For more information on each feature, see the following links:
INITIATE_PRE_AUTHORISATION, INITIATE_PRE_AUTHORISATION_ACCOUNTS, INITIATE_PRE_AUTHORISATION_PAYMENTS, INITIATE_ACCOUNT_REQUEST, INITIATE_EMBEDDED_ACCOUNT_REQUEST, ACCOUNT_REQUEST_DETAILS, ACCOUNTS, ACCOUNT, ACCOUNT_TRANSACTIONS, ACCOUNT_STATEMENTS, ACCOUNT_STATEMENT, ACCOUNT_STATEMENT_FILE, ACCOUNT_SCHEDULED_PAYMENTS, ACCOUNT_DIRECT_DEBITS, ACCOUNT_PERIODIC_PAYMENTS, ACCOUNT_TRANSACTIONS_WITH_MERCHANT, IDENTITY, ACCOUNTS_WITHOUT_BALANCE, ACCOUNT_WITHOUT_BALANCE, ACCOUNT_BALANCES, INITIATE_SINGLE_PAYMENT_SORTCODE, EXISTING_PAYMENT_INITIATION_DETAILS, CREATE_SINGLE_PAYMENT_SORTCODE, EXISTING_PAYMENTS_DETAILS, INITIATE_DOMESTIC_SINGLE_PAYMENT, INITIATE_EMBEDDED_DOMESTIC_SINGLE_PAYMENT, CREATE_DOMESTIC_SINGLE_PAYMENT, INITIATE_EMBEDDED_BULK_PAYMENT, INITIATE_DOMESTIC_SINGLE_INSTANT_PAYMENT, CREATE_DOMESTIC_SINGLE_INSTANT_PAYMENT, INITIATE_DOMESTIC_VARIABLE_RECURRING_PAYMENT, CREATE_DOMESTIC_VARIABLE_RECURRING_PAYMENT, INITIATE_DOMESTIC_VARIABLE_RECURRING_PAYMENT_SWEEPING, CREATE_DOMESTIC_VARIABLE_RECURRING_PAYMENT_SWEEPING, INITIATE_DOMESTIC_VARIABLE_RECURRING_PAYMENT_COMMERCIAL, CREATE_DOMESTIC_VARIABLE_RECURRING_PAYMENT_COMMERCIAL, INITIATE_DOMESTIC_SCHEDULED_PAYMENT, CREATE_DOMESTIC_SCHEDULED_PAYMENT, INITIATE_DOMESTIC_PERIODIC_PAYMENT, CREATE_DOMESTIC_PERIODIC_PAYMENT, PERIODIC_PAYMENT_FREQUENCY_EXTENDED, INITIATE_INTERNATIONAL_SCHEDULED_PAYMENT, CREATE_INTERNATIONAL_SCHEDULED_PAYMENT, INITIATE_INTERNATIONAL_PERIODIC_PAYMENT, CREATE_INTERNATIONAL_PERIODIC_PAYMENT, INITIATE_INTERNATIONAL_SINGLE_PAYMENT, CREATE_INTERNATIONAL_SINGLE_PAYMENT, INITIATE_BULK_PAYMENT, CREATE_BULK_PAYMENT, EXISTING_BULK_PAYMENT_DETAILS, TRANSFER, OPEN_DATA_PERSONAL_CURRENT_ACCOUNTS, OPEN_DATA_ATMS, READ_DOMESTIC_SINGLE_REFUND, READ_DOMESTIC_SCHEDULED_REFUND, READ_DOMESTIC_PERIODIC_PAYMENT_REFUND, READ_INTERNATIONAL_SINGLE_REFUND, READ_INTERNATIONAL_SCHEDULED_REFUND, ACCOUNT_BENEFICIARIES, INITIATE_ONETIME_PRE_AUTHORISATION_PAYMENTS, INITIATE_ONETIME_PRE_AUTHORISATION_ACCOUNTS, INITIATE_ONETIME_PRE_AUTHORISATION, VARIABLE_RECURRING_PAYMENT_FUNDS_CONFIRMATION Was this page helpful?