# Repository contents

`GET /workspaces/:workspace/projects/:project_name/repository/contents`

Returns the contents of the repository for the specified revision or HEAD

**Required Scopes:** `REPOSITORY_READ`

## URL Parameters

```typescript
interface URLParameters {
  /** The human-readable ID of the workspace */
  workspace: string; // Example: "my-company"
  /** The human-readable ID of the project */
  project_name: string; // Example: "my-project"
}
```

## Query Parameters

```typescript
interface QueryParameters {
  /** The git revision (branch, tag, or commit) to retrieve contents from */
  revision?: string; // Example: "main"
}
```

## Response Body

```typescript
interface ResponseBody {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  contents?: RepositoryContentView[];
}
```

## Type Definitions

```typescript
interface RepositoryContentView {
  /** API endpoint to GET this object */
  url?: string;
  /** Web URL to view this object in Buddy.works */
  html_url?: string;
  /** The type of the content */
  content_type?: "FILE" | "DIR" | "SYMLINK" | "SUB_MODULE" | "EXTERNAL";
  /** The encoding of the content. Possible values: `base64` */
  encoding?: string;
  /** The size of the file in bytes (null for directories) */
  size?: number;
  /** The name of the file or directory */
  name?: string;
  /** The path to the file or directory */
  path?: string;
  /** The base64-encoded content of the file (only for files) */
  content?: string;
  /** The target path for symbolic links */
  target?: string;
}

```

## Response Example

**Status:** `200 Directory contents`

```json
{
  "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents",
  "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content",
  "contents": [
    {
      "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents/src",
      "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content/%2Fsrc",
      "content_type": "DIR",
      "name": "src",
      "path": "/src"
    },
    {
      "url": "https://api.buddy.works/workspaces/my-workspace/projects/my-project/repository/contents/ala.txt",
      "html_url": "https://app.buddy.works/my-workspace/my-project/repository/content/ala.txt",
      "content_type": "FILE",
      "encoding": "base64",
      "size": 10,
      "name": "ala.txt",
      "path": "ala.txt",
      "content": "77+977+977+9eg=="
    }
  ]
}
```

---
Original source: https://buddy.works/docs/api/platform/projects/get/repository-contents