# GitHub Raw File

Returns the raw content of one file in a repository at a given ref, verbatim. The response reports its size and whether it was truncated at the response cap. A truncated file means the bytes are incomplete: use /repository/tree?recursive=1 to locate a smaller path, /repository/files for the contents listing, or /repository/readme for the decoded readme.

- **Documentation:** [https://scrappa.co/docs/github-api/github_repository_raw_file](https://scrappa.co/docs/github-api/github_repository_raw_file)
- **API group:** GitHub API
- **Endpoint:** `GET https://scrappa.co/api/github/repository/raw-file`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `owner` | string | Yes | Repository owner login or organization, e.g. laravel. |
| `repo` | string | Yes | Repository name without the owner, e.g. framework. |
| `ref` | string | Yes | Branch, tag or commit sha. |
| `path` | string | Yes | Path to the file inside the repository. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/github/repository/raw-file?owner=laravel&repo=framework&ref=13.x&path=README.md"
```

## Example response

```json
{
    "search_parameters": {
        "engine": "github_repository_raw_file",
        "owner": "laravel",
        "repo": "framework",
        "ref": "13.x",
        "path": "README.md"
    },
    "repository": "laravel/framework",
    "ref": "13.x",
    "path": "README.md",
    "content": "# Laravel",
    "size": 9,
    "truncated": false
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A parameter failed validation. |
| 404 | Not Found | GitHub has no public resource at that address. For a repository this also covers a private or renamed repository, which is indistinguishable anonymously. |
| 503 | GitHub Upstream Unavailable | The upstream service is temporarily unavailable. Please retry shortly. |
| 500 | Parser Drift | GitHub returned a response shape this parser does not recognise. The incident has been reported; retrying will return the same result. |
| 406 | Not Acceptable Upstream | GitHub has no JSON representation for this route, or rejected the request headers. Never charged. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
