POST /v1/consents

Create an account information consent resource at the ASPSP regarding access to accounts specified in the request.

 

Query parameters

No query parameters.

 

Request header

Attribute

Type

Condition

Description

X-Request-ID

String

Mandatory

ID of the request, unique to the call, as determined by the initiating party (TPP).

Authorization

String

Mandatory

The oAuth2 Bearer token obtained from the performed SCA performed prior to this request.

API-Key

String

Mandatory

Consumer key available on the developers portal.

TPP-Redirect-URI

String

Mandatory

URI of the TPP, where the transaction flow shall be redirected to after a Redirect.

 

Request body

No request body

 

Response Code

HTTP Response Code 201 (Created).

 

Response headers

Attribute

Type

Condition

Description

X-Request-ID

UUID

Mandatory

ID of the request, unique to the call, as determined by the initiating party (TPP).

 

Response body

Attribute

Type

Condition

Description

consentStatus

Consent

Status

Mandatory

Authentication status of the consent.

consentId

String

Mandatory

Identification of the consent resource as it is used in the API structure.

_links

Array

Mandatory

A list of hyperlinks to be recognized by the TPP.

psuMessage

String

Optional

Messages to be displayed to the PSU.

 

Example

 

Request

curl -X POST \
https://mp-psd2-api.mypos.com/v1/consents \
-H 'API-Key: aGDmxHAmpMWUL1txqCsjEcOS' \
-H 'Authorization: Bearer oqeeWzoYfqkf1RsfyaB3hyNiLvY7GNAV6Kta7sGa9X' \
-H 'TPP-Redirect-URI: https://test.com' \
-H 'X-Request-ID: a552babc-7081-44e7-9361-61eb17e0bfd9'
import requests

url = "https://mp-psd2-api.mypos.com/v1/consents"

headers = {
    'API-Key': "aGDmxHAmpMWUL1txqCsjEcOS",
    'X-Request-ID': "a552babc-7081-44e7-9361-61eb17e0bfd9",
    'TPP-Redirect-URI': 'https://test.com',
    'Authorization': "Bearer oqeeWzoYfqkf1RsfyaB3hyNiLvY7GNAV6Kta7sGa9X"
    }

response = requests.request("POST", url, headers=headers)

print(response.text)
var request = require("request");

var options = { method: 'POST',
  url: 'https://mp-psd2-api.mypos.com/v1/consents',
  headers: {
     'Authorization': 'Bearer oqeeWzoYfqkf1RsfyaB3hyNiLvY7GNAV6Kta7sGa9X',
     'X-Request-ID': 'a552babc-7081-44e7-9361-61eb17e0bfd9',
     'TPP-Redirect-URI': 'https://test.com',
     'API-Key': 'aGDmxHAmpMWUL1txqCsjEcOS' 
  }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
<?php

$request = new HttpRequest();
$request->setUrl('https://mp-psd2-api.mypos.com/v1/consents');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'Authorization' => 'Bearer oqeeWzoYfqkf1RsfyaB3hyNiLvY7GNAV6Kta7sGa9X',
  'X-Request-ID' => 'a552babc-7081-44e7-9361-61eb17e0bfd9',
  'TPP-Redirect-URI' => 'https://test.com',
  'API-Key' => 'aGDmxHAmpMWUL1txqCsjEcOS'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

 

Response 
{
    "consentId": "a0a0733f-ec20-4186-b883-25419485b337",
    "consentStatus": "Received",
    "_links": {
        "self": {
            "href": "v1/consents/a0a0733f-ec20-4186-b883-25419485b337"
        },
        "scaStatus": {
            "href": "v1/consents/a0a0733f-ec20-4186-b883-25419485b337/status"
        },
        "scaOAuth": {
            "href": "https://www.mypos.com?open_bank_consent_id=a0a0733f-ec20-4186-b883-25419485b337"
        }
    }
}