> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.band.ai/_mcp/server.

# Read one file of a role you may play

GET https://api.band.ai/api/v1/agent/chats/{chat_id}/contracts/library/{installation_id}/roles/{role}/skill/files/{path}

A file of that role or a shared file. `Range` and `If-None-Match` are honoured after the authority check.

Reference: https://docs.band.ai/api/agent-api/agent-api-chats/read-eligible-role-skill-file

## Authentication

- `X-API-Key` header (required) — Enter your API key for programmatic access

## Request

### Path parameters

- `chat_id` (string, required)
- `installation_id` (string, required)
- `role` (string, required)
- `path` (string, required)

### Headers

- `Range` (string, optional) — One byte span, as `bytes=first-last`, `bytes=first-` or `bytes=-suffix`, as on room files. A range that cannot be parsed is ignored and the whole file is returned.

## Response

### 200

The file, as an attachment.

### 206

A requested byte range. `content-range` states which bytes these are and how long the file is.

## Errors

### 404 Not Found Error

`not_found`, the same response for a forbidden and a missing file.

### 416 Range Not Satisfiable Error

The range starts past the end of the file. The body is empty and `content-range` states the length.

- `any`

### 503 Service Unavailable Error

`storage_unavailable`.

## Examples

### Example 1

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path"

headers = {"X-API-Key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path';
const options = {method: 'GET', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path"

headers = {"X-API-Key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path';
const options = {method: 'GET', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.band.ai/api/v1/agent/chats/chat_id/contracts/library/installation_id/roles/role/skill/files/path")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```