> ## Documentation Index
> Fetch the complete documentation index at: https://gogs.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get contents

> Get the contents of a file, directory, symlink, or submodule in a repository.



## OpenAPI

````yaml GET /repos/{owner}/{repo}/contents/{path}
openapi: 3.0.3
info:
  title: Gogs API
  version: v1
  description: >-
    RESTful API for interacting with your Gogs instance. Follows a format
    similar to the GitHub REST API v3.
servers:
  - url: https://gogs.example.com/api/v1
security:
  - AccessToken: []
tags:
  - name: Repositories
    description: Create, search, and manage repositories, branches, commits, and contents
  - name: Collaborators and Deploy Keys
    description: Manage repository collaborators and deploy keys
  - name: Releases
    description: List repository releases
  - name: Webhooks
    description: Create, edit, and delete repository webhooks
  - name: Issues
    description: Manage issues, comments, labels, and milestones
  - name: Users
    description: Search users, manage access tokens, emails, followers, and public keys
  - name: Organizations
    description: Manage organizations, members, and teams
  - name: Administration
    description: Site administration endpoints (requires admin privileges)
  - name: Miscellaneous
    description: Markdown rendering and Git data endpoints
paths:
  /repos/{owner}/{repo}/contents/{path}:
    get:
      tags:
        - Repositories
      summary: Get contents
      description: >-
        Get the contents of a file, directory, symlink, or submodule in a
        repository.
      operationId: getContents
      parameters:
        - name: owner
          in: path
          required: true
          schema:
            type: string
          description: Repository owner
        - name: repo
          in: path
          required: true
          schema:
            type: string
          description: Repository name
        - name: path
          in: path
          required: true
          schema:
            type: string
          description: File or directory path
        - name: ref
          in: query
          required: false
          schema:
            type: string
          description: Branch, tag, or commit. Defaults to the default branch.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Content'
        '404':
          description: Resource not found.
components:
  schemas:
    Content:
      type: object
      properties:
        type:
          type: string
          enum:
            - file
            - dir
            - symlink
            - submodule
        encoding:
          type: string
        size:
          type: integer
        name:
          type: string
        path:
          type: string
        content:
          type: string
        sha:
          type: string
        url:
          type: string
        git_url:
          type: string
        html_url:
          type: string
        download_url:
          type: string
        _links:
          type: object
          properties:
            git:
              type: string
            self:
              type: string
            html:
              type: string
  securitySchemes:
    AccessToken:
      type: apiKey
      in: header
      name: Authorization
      description: 'Personal access token. Use format: token {YOUR_ACCESS_TOKEN}'

````