Connect Revolut Business to Rig
Revolut Business is a multi-currency business bank. Rig syncs your accounts, transactions and counterparties into your warehouse, so cash position and spend sit beside your other finance data. The connection uses a certificate you create, a client ID and a refresh token, so setup takes a few terminal commands.
Before you start
- You need these Revolut Business permissions to configure the API: Manage Integrations and Manage API under API & Integrations, and View Business under Billing.
- You need a terminal with
openssl. On Windows, Revolut recommends WSL. - Plan about 15 minutes. The authorisation code you collect in step 5 is valid for two minutes, so have the token command ready first.
Step 1: Create a certificate and register it with Revolut
Revolut identifies Rig by a certificate pair. You keep the private key and give Revolut the public certificate.
- In a terminal, run
openssl genrsa -out privatecert.pem 2048. - Run
openssl req -new -x509 -key privatecert.pem -out publiccert.cer -days 1825. Answer at least one prompt, such as Country Name. - In the Revolut Business web app, click the gear icon, then go to APIs and choose Business API.
- In the API Certificates section, click Add API certificate.
- Paste the full contents of
publiccert.cerinto X509 public key, including theBEGIN CERTIFICATEandEND CERTIFICATElines. - Set OAuth redirect URI to
https://www.example.com. Rig signs its requests for thewww.example.comdomain, and Revolut requires that domain to match the redirect URI. - Give the certificate a clear title and click Continue.
- Copy the ClientID shown in the certificate details. This is the Client ID you give Rig.
IP whitelisting
Revolut lets you restrict a certificate to a list of IP addresses. Leave it empty for Rig, or contact us for the addresses to add.
Step 2: Authorise the application and get a refresh token
You make one signed request to Revolut to obtain a refresh token, which does not expire.
- In the folder holding
privatecert.pem, createheader.jsoncontaining{"alg": "RS256", "typ": "JWT"}. - Create
payload.jsonwithissset towww.example.com,subset to your Client ID,audset tohttps://revolut.com, andexpset to a Unix timestamp in seconds a few days ahead. Enterexpas a number. - Follow Revolut's "Generate a client assertion" commands to sign the header and payload with your private key. This produces
client_assertion.txt, your JWT. - In the Business API settings, open your certificate and click Enable access. To limit what you grant, add
&scope=READto the address Revolut opens. - Click Authorise and complete the two-factor prompt. Revolut redirects to your redirect URI with a
codein the address. It is valid for two minutes. - Straight away, send the token request from Revolut's guide: a POST to
https://b2b.revolut.com/api/1.0/auth/tokenwithgrant_type=authorization_code, yourcode,client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearerand your JWT asclient_assertion. - Copy the
refresh_tokenfrom the response.
Keep the JWT and refresh token private
Revolut warns that anyone holding the JWT and refresh token can reach your banking data. Do not share them or paste them anywhere but Rig. The JWT is only needed for this step, because Rig signs its own requests with the private key.
Step 3: Prepare the private key for Rig
Rig takes the whole PEM key on one line, with line breaks written as the characters \n.
- Run
awk 'NF {printf "%s\\n", $0}' privatecert.pemin the same folder. - Copy the single line of output, from
-----BEGINto the final\n.
Step 4: Connect it in Rig
Adding a source needs a workspace owner, or a role with the Manage connections permission, on a workspace where you manage your own connections. If the Connectors tab says “Data ingestion for this workspace is managed by Rig”, ask an owner or Rig support to add the source.
- In Rig, open
Connections, choose theConnectorstab and go toSources & actions. - Search for Revolut Business, open the card and click
Connect. - Client ID: The ClientID from your certificate details.
- Private key (PEM, escaped newlines): The single line you prepared in step 3.
- Refresh token: The
refresh_tokenfrom Revolut's response. - Earliest transaction date: The first date to load transactions from. Leave
2020-01-01T00:00:00Zas it is for everything since then. - Click
Continue. Rig checks the credentials and lists the streams it can reach, so choose the ones you want and clickConnect. - The source then syncs on its schedule, which is nightly unless you change it. To load data straight away, click
Syncon its row;Testpulls a small sample first if you want to check the connection.
What Rig pulls in
Revolut Business lands in its own revolut_business schema in your warehouse:
- Accounts: every business account, with its currency and balance fields.
- Transactions: one row per transaction leg, so a transfer that touches two accounts can appear as more than one row.
- Counterparties: every saved counterparty.
Transactions load incrementally from the earliest date you set. Accounts and counterparties are re-read in full each sync.
Good to know
- Revolut access tokens last 40 minutes and Rig requests a new one using the refresh token, which does not expire.
- Refreshing an access token invalidates the previous one, so avoid running other scripts with the same refresh token while Rig syncs.
- Keep your private key. The certificate in Revolut stays valid for the 1825 days set in step 1, and you need the same key if you ever repeat the authorisation.
- To disconnect Revolut Business, click the bin icon on the source's row under
Sources & actions. Only whoever connected the source or a workspace owner can do this, and data already synced stays in the warehouse.
What people use this for
- Track multi-currency balances and cash position
- Analyse spend by counterparty and category
- Reconcile transfers and card payments