# Download a file through a download link

`GET /v4/files/links/{token}`

Downloads the file behind a link from `POST /v4/files/{id}/download-link`. Always an attachment. Answers 404 in plain text once the link has expired or access is gone.

No Authorization header is needed or read: the token in the path is the credential. `disposition` is ignored and range requests aren't supported.

Authentication: no security requirement declared for this operation.

Parameters:

- `token` (path, string, required) - Link token (starts with `pfdl_`)
  Type: string

Responses:

- 200: File bytes

Content type: application/octet-stream

Type: string, binary

- 404: The link has expired or is no longer valid

Content type: text/plain

Type: string

- 503: Downloads are temporarily unavailable

Content type: text/plain

Type: string

## Examples

### cURL

```bash
curl -X GET 'https://api.searchsoftware.nl/v4/files/links/string'
```

### TypeScript

```typescript
const response = await fetch('https://api.searchsoftware.nl/v4/files/links/string', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://api.searchsoftware.nl/v4/files/links/string')
print(response.text)
```

### Ruby

```ruby
require 'net/http'
require 'json'

uri = URI('https://api.searchsoftware.nl/v4/files/links/string')
request = Net::HTTP::Get.new(uri)

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
data = JSON.parse(response.body)
```

### Go

```go
package main

import (
  "fmt"
  "io"
  "net/http"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.searchsoftware.nl/v4/files/links/string", nil)
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  data, _ := io.ReadAll(resp.Body)
  fmt.Println(string(data))
}
```

### PHP

```php
<?php
$ch = curl_init('https://api.searchsoftware.nl/v4/files/links/string');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

### Rust

```rust
use reqwest;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let client = reqwest::Client::new();
    let response = client.get("https://api.searchsoftware.nl/v4/files/links/string")
        .send()
        .await?
        .text()
        .await?;
    println!("{}", response);
    Ok(())
}
```
