> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yapily.com/llms.txt
> Use this file to discover all available pages before exploring further.

# METTLE

## Links

* [Developer Portal](https://developer.lloydsbanking.com/)

## Scopes

* Account Information🔒
* Payment Initiation🔒

## Live Environment

**Precondition**:To connect to Mettle Bank, an application needs to be created. Once the application is created a **client\_id** and **client\_secret** are generated.

**Pre-requisites for Registration:**

1. Valid QWAC / QSEAL certificates.
2. Upload the signing (QSEAL) and transport (QWAC) certificates into V2 services

**Request format:**

```shell theme={null}
curl --location --request POST 'https://api.yapily.com/certificates/keys/' \
 --header 'Authorization: Basic YOUR_APPLICATION_CREDENTIALS_AS_BASIC_AUTH' \
 --header 'Content-Type: application/json' \
 --data-raw '[{
     "pem": "$YOUR_PUBLIC_KEY_AS_PEM",
     "key": "$YOUR_PRIVATE_KEY",
     "kid": "$CERT_KID",
     "name" : "$CERTIFICATE_NAME",
     "type": "Q_WAC"
 }]'
```

* Where pem and key need to be in the following format:
  `-----BEGIN PRIVATE KEY-----\n
  KEY_HASH\n
  MORE_KEY_HASH\n
  SOME_MORE_KEY_HASH\n -----END PRIVATE KEY-----`

**Please note:**

1. Spaces between "begin/end private key" words are respected.
2. Begin/End Private Key are included in the value for thepemandkeyproperties.
3. Every line break is escaped with a "\n".
4. There is NO "\n" at the end.

**Response format:**

* Once you have uploaded your certificates successfully, you will receive a response containing an "id". Please make sure that you save them and note to which certificates they belong.
  ```json theme={null}
  {
  "id": "d16f87d3-4222-4173-b8b9-44aeccacae7d",
  ....
  }
  ```

**If the Certificates have already been uploaded:**

Then, it can be retrieved from the endpoint:

[`GET 'https://api.yapily.com/certificates/keys/'`](https://api.yapily.com/certificates/keys/)

**Response format:**

```json theme={null}
{
  "id": "d16f87d3-4222-4173-b8b9-44aeccacae7d",
  "type": "Q_SEAL",
  .....
 },
 {
  "id": "76b453ea-9e41-42e0-a357-d6d7980bf02b",
  "type": "Q_WAC",
  .....
 }
```

## Registration

* Use the following request to register any **Mettle** institution with Yapily.

```shell theme={null}
curl --location --request POST'https://api.yapily.com/institutions/{{INSTITUTION_ID}}/manual/register'\
 --header'Content-Type: application/json'\
 --header'x-yapily-force-platform: {{platform_version}}'\
 --header'Authorization: Bearer {{token}}'\
 --data-raw'{
     "signingKeyID":"{{SIGNING_KEY_UUID}}",
     "transportKeyID":"{{TRANSPORT_KEY_UUID}}",
     "clientId": "{{client_id_from_created_application}}",
     "clientSecret": "{{client_secret_from_created_application}}",
     "apiTypes": ["AISP", "PISP"]
 }'
```

**Where:**

* `INSTITUTION_ID` is the Yapily institution id.
* `SIGNING_KEY_UUID` and `TRANSPORT_KEY_UUID` are the "ids" that you saved before when uploading the certificates (**signing** and **transport**).
* `client_id_from_created_application` and `client_secret_from_created_application` are valid credentials for the Mettle developer portal.

**Response format:**

* The response from the registration call should also contain an "id", which would mean that the registration was successful. Please save that "id" and note to which bank it belongs.
  ```json theme={null}
  {
  "id": "d16f87d3-4222-4173-b8b9-44aeccacae7d",
  ....
  }
  ```

## Sandbox Environment

Not available at the moment

## Support

If you require technical support with certificate management, please contact [Support](/resources/support).
