# The old export urls

Before there was an API, results were downloaded by adding `?export=` and a key to an ordinary search url. Those urls still work, exactly as they always have, byte for byte. **They are not going away.**

```
https://publicwww.com/websites/%22angular.min.js%22/?export=csv&key=YOUR_KEY
```

| `export=` | Returns |
| --- | --- |
| `urls` | One url per line. |
| `csv` | `domain;rank` |
| `csvu` | `url;rank` |
| `csvsnippets` | `domain;rank;snippet` |
| `csvsnippetsu` | `url;rank;snippet` |
| `cluster` | Saves the results as a [cluster](https://publicwww.com/docs/clusters/) instead of downloading them. |

`&delimiterColumns=` and `&delimiterSnippets=` change the separators, and `https://publicwww.com/profile/api_status.xml` reports the day's usage as XML. Pass the key in the `Authorization: Bearer <your api key>` header; the older `?key=` form still works but is deprecated, because a key in the address ends up in browser history and server logs.

## Why they are separate

These urls are the compatibility layer, and keeping them that way is what lets the API be a normal modern one. Their output is pinned byte for byte by a test that runs on every change, so a script written years ago keeps parsing what it has always parsed. Nothing new is added to them.

## Moving a script over

The nearest equivalents:

| Old | New |
| --- | --- |
| `?export=csv` | `format=csv` |
| `?export=csvu` | `format=csv&columns=url,rank` |
| `?export=urls` | `format=txt` |
| `?export=csvsnippets` | `format=csv&snippets=1` |
| `?export=csvsnippetsu` | `format=csv&columns=url,rank,snippets&snippets=1` |
| `&key=` | `Authorization: Bearer` |
| `&delimiterColumns=` | `delimiter=` |
| the query in the url path | `query=`, or a JSON body |
| `api_status.xml` | `/v1/account` |

The columns line up, so a parser usually does not change. What does change is worth having:

- A bad key is `401` with a JSON body, not `200` with the words `Wrong API key` in it where the rows should be.
- Arriving too fast is `429` straight away with a `Retry-After`, instead of the connection being held open for up to half a minute and then refused.
- A spent quota is an error. On the old urls it quietly drops you to free-tier limits and returns fewer rows, with nothing in the response saying so.
- A shortened answer is marked - `X-Truncated`.
- Paging, so a client need not download everything to look at the first twenty.

Source: https://publicwww.com/docs/api/legacy/
