---
updatedAt: 2026-01-16T00:52:24.000Z
agentTools:
  projectIndex: https://docs.truelayer.com/llms.txt
---

# Sign your requests [PayDirect]

Learn how to sign your POST requests to the PayDirect API.

All POST requests to PayDirect APIs must be signed by including a valid `Tl-Signature` HTTP header.

When you sign your requests to our APIs, you add a second layer of security on top of the authorisation bearer token which guarantees that the payload has not been tampered with.

> 📘 Supported algorithms
>
> The only supported <a href="https://tools.ietf.org/html/rfc7518" target="_blank">signing algorithm</a> for POST requests to Payouts API is <a href="https://tools.ietf.org/html/rfc7518#page-9" target="_blank">ES512</a>.

ES512 belongs to the family of <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" target="_blank">Elliptic Curve Digital Signature Algorithms (ECDSA)</a>.

To sign an HTTP request using ECDSA you will need to generate an Elliptic Curve (EC) <a href="https://en.wikipedia.org/wiki/Public-key_cryptography" target="_blank">key pair</a>. This includes:

* a public key. Upload this in the **Payments Settings** page in our **Console**.
* a private key. Use this to sign requests. Don't share this with anyone outside of your organisation. ES512, in particular, requires a key pair that uses the P-521 family of elliptic curves (also known as `secpt521r1`).

## Generate a signing key pair

You can generate a key pair using <a href="https://www.openssl.org/" target="_blank">`openssl`</a>.

1. To generate the private key, run:

```bash
docker run --rm -v ${PWD}:/out -w /out -it alpine/openssl ecparam -genkey -name secp521r1 -noout -out ec512-private-key.pem
```

2. You can then obtain the public key by running:

```bash
docker run --rm -v ${PWD}:/out -w /out -it alpine/openssl ec -in ec512-private-key.pem -pubout -out ec512-public-key.pem
```

3. Go to **Console** > **Payments Settings** and upload the file `ec512-public-key.pem`.

## Sign your requests with our libraries

In <a href="https://github.com/TrueLayer/truelayer-signing" target="_blank">our public repository</a>, we maintain libraries in a range of languages. These provide methods for signing and verifying according to the scheme. Our backend libraries also make use of these signing libraries for the API requests.

E.g. Java *com.truelayer.truelayer-signing*

```java
// `Tl-Signature` value to send with the request.
String tlSignature = Signer.from(kid, privateKey)
        .header("Idempotency-Key", idempotencyKey)
        .method("post")
        .path(path)
        .body(body)
        .sign();
```

## Sign your requests without using libraries

> 🚧 Manual signing
>
> We don't recommend signing requests manually. Instead, we encourage you to use our signing libraries for easier integration.

To manually generate `Tl-Signature` headers, or verify webhook signatures, refer to  <a href="https://github.com/TrueLayer/truelayer-signing" target="_blank">TrueLayer/truelayer-signing</a>.

In particular see the <a href="https://github.com/TrueLayer/truelayer-signing/blob/main/request-signing-v2.md#request-signing-v2" target="_blank">document describing the signing scheme</a>.

## Test your signing logic

You can send a POST request to our `/v1/test-signature` endpoint to verify that you have correctly implemented request signing. The `/v1/test-signature` endpoint will validate your `Tl-Signature` header and return a `204 No Content` in case of success. It does not perform any kind of validation on the body schema.

```shell Test your signing
curl -X POST \
	-H "Authorization: Bearer ${access_token}" \
	-H "Tl-Signature: ${signature}" \
	--data '{"nonce":"9f952b2e-1675-4be8-bb39-6f4343803c2f"}' \
	https://paydirect.truelayer-sandbox.com/v1/test-signature
```