---
title: "Exchange Rate API with XML Output (plus CSV and XLSX)"
description: "Get live and official exchange rates as XML: add format=xml to any AllRatesToday rate endpoint. Real responses, PHP, C# and Python parsing examples, and CSV/XLSX for spreadsheets and ERP imports."
canonical: https://allratestoday.com/exchange-rate-api-xml/
source: AllRatesToday (https://allratestoday.com/) — Markdown mirror of the page above; index of all pages at https://allratestoday.com/llms.txt
generated: 2026-11-23T14:03:24.653Z
---

# Exchange Rate API with XML Output (plus CSV and XLSX)

Get live and official exchange rates as XML: add format=xml to any AllRatesToday rate endpoint. Real responses, PHP, C# and Python parsing examples, and CSV/XLSX for spreadsheets and ERP imports.

By [Madhushan](https://allratestoday.com/authors/madhushan/), Founder & Lead Developer · Updated 16 Oct 2026

Plenty of systems still want XML: ERP importers, .NET and Java back offices, middleware like BizTalk or SAP PI, and anything built before JSON won. AllRatesToday returns XML from the same endpoints as JSON. Add `format=xml` and nothing else changes: same parameters, same key, same quota. `format=csv` and `format=xlsx` work the same way for spreadsheets.

## Which endpoints support XML

| Endpoint | Returns | Formats |
| --- | --- | --- |
| `/api/v1/rates` | Live mid-market rates, a dated rate (`time=`) or a daily range (`from=`/`to=`) | json, xml, csv, xlsx |
| `/api/historical-rates` | Daily series over `period=` 1d, 7d, 30d or 1y | json, xml, csv, xlsx |
| `/api/v1/central-bank/{bank}/latest` | A central bank's latest official table (123 banks) | json, xml, csv, xlsx |
| `/api/v1/central-bank/{bank}/{date}` | The official table in force on a date | json, xml, csv, xlsx |

Conversion responses (`/api/v1/rates?amount=`) are JSON only. Ask for the rate in XML and multiply on your side.

## Live rates as XML

```
curl "https://allratestoday.com/api/v1/rates?source=USD&target=EUR,GBP&format=xml" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```
<?xml version="1.0" encoding="UTF-8"?>
<rates>
  <rates>
    <rate>
      <rate>0.888455</rate>
      <source>USD</source>
      <target>EUR</target>
      <time>2026-10-16T12:07:01+0000</time>
    </rate>
    <rate>
      <rate>0.749738</rate>
      <source>USD</source>
      <target>GBP</target>
      <time>2026-10-16T12:07:01+0000</time>
    </rate>
  </rates>
</rates>
```

The response is sent as `Content-Type: application/xml; charset=utf-8`.

## Official central bank rates as XML

The official table a central bank published, under that bank's own publication date. This is what accounting and customs rules usually require:

```
curl "https://allratestoday.com/api/v1/central-bank/ecb/latest?format=xml&api_key=YOUR_API_KEY"
```

```
<?xml version="1.0" encoding="UTF-8"?>
<rates>
  <bank>ecb</bank>
  <name>European Central Bank</name>
  <rate_date>2026-10-15</rate_date>
  <rates>
    <rate><base>EUR</base><quote>AUD</quote><type>reference</type><value>1.6218</value></rate>
    <rate><base>EUR</base><quote>BRL</quote><type>reference</type><value>5.6679</value></rate>
    <rate><base>EUR</base><quote>CAD</quote><type>reference</type><value>1.5923</value></rate>
    ...
  </rates>
</rates>
```

Add `&source=USD&target=EUR` to get one resolved pair instead of the whole table. Bank codes are on the [central bank coverage map](https://allratestoday.com/central-bank-rates-api/). Dynamics 365 Business Central reads this feed directly: see the [Business Central guide](https://allratestoday.com/docs/integrations/business-central/).

## Historical series as XML

```
curl "https://allratestoday.com/api/historical-rates?source=USD&target=EUR&period=7d&format=xml" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```
<?xml version="1.0" encoding="UTF-8"?>
<historical_rates>
  <source>USD</source>
  <target>EUR</target>
  <data>
    <item><date>2026-10-10</date><rate>0.892738</rate><timestamp>1791590400000</timestamp></item>
    <item><date>2026-10-11</date><rate>0.892738</rate><timestamp>1791676800000</timestamp></item>
    ...
  </data>
</historical_rates>
```

## Parsing examples

### PHP (SimpleXML)

```
<?php
$url = 'https://allratestoday.com/api/v1/rates?source=USD&target=EUR,GBP&format=xml&api_key=' . getenv('ALLRATES_KEY');
$xml = simplexml_load_string(file_get_contents($url));

foreach ($xml->rates->rate as $r) {
    echo $r->source, '/', $r->target, ' = ', (float) $r->rate, PHP_EOL;
}
```

### C# (.NET, LINQ to XML)

```
using System.Xml.Linq;

var http = new HttpClient();
http.DefaultRequestHeaders.Add("Authorization", "Bearer " + Environment.GetEnvironmentVariable("ALLRATES_KEY"));
var xml = await http.GetStringAsync(
    "https://allratestoday.com/api/v1/rates?source=USD&target=EUR,GBP&format=xml");

foreach (var r in XDocument.Parse(xml).Root.Element("rates").Elements("rate"))
    Console.WriteLine($"{r.Element("source").Value}/{r.Element("target").Value} = {decimal.Parse(r.Element("rate").Value)}");
```

### Python (ElementTree)

```
import os, requests, xml.etree.ElementTree as ET

xml = requests.get(
    "https://allratestoday.com/api/v1/rates",
    params={"source": "USD", "target": "EUR,GBP", "format": "xml"},
    headers={"Authorization": f"Bearer {os.environ['ALLRATES_KEY']}"},
    timeout=10,
).text

for r in ET.fromstring(xml).find("rates").findall("rate"):
    print(r.findtext("source"), r.findtext("target"), float(r.findtext("rate")))
```

## Authentication for XML clients

Send the key as `Authorization: Bearer YOUR_API_KEY`. If your importer can only take a URL, put it in the query string as `api_key=YOUR_API_KEY` on `/api/v1/` endpoints. `/api/historical-rates` accepts the header only.

## CSV and XLSX

`format=csv` returns UTF-8 CSV with a byte-order mark, so Excel shows currency symbols correctly. `format=xlsx` returns a real Excel workbook with typed dates and numbers, not a renamed CSV. The [Excel guide](https://allratestoday.com/blog/excel-exchange-rates/) shows how to refresh rates in a workbook automatically.

## FAQ

### Is XML available on the free plan?

Yes. Output format isn't plan-gated: every format works with every key, free included. Historical endpoints need a paid plan.

### Does an XML request cost more than JSON?

No. It's the same request and counts once against your quota.

### Is there an XSD schema?

Not yet. The element names match the JSON field names one-to-one, so the JSON examples in the [docs](https://allratestoday.com/docs/) describe each field.

## Get rates as XML

Free API key in 30 seconds. No credit card.

 [Get free API key](https://allratestoday.com/register/) [Read the docs](https://allratestoday.com/docs/)

## Related

  [JSON and CSV outputReal responses and parsing examples](https://allratestoday.com/exchange-rate-api-json-csv/) [Exchange rates in ExcelAuto-refreshing rates in a workbook](https://allratestoday.com/blog/excel-exchange-rates/) [ERP integrationsBusiness Central, SAP, Xero, QuickBooks, Odoo](https://allratestoday.com/docs/integrations/) [Currency fluctuation APIChange and % change over any period](https://allratestoday.com/currency-fluctuation-api/) [OANDA API alternativeJSON, XML and CSV from €4.99/mo](https://allratestoday.com/compare/oanda-alternative/)
