> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.sevalla.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Read static site repository file

> Read the contents of a single file from the static site Git repository at a given ref. Defaults to the commit of the latest successful deployment so you read exactly the code that is deployed. Binary files and files larger than 1 MB return metadata only with a null `content` (check `is_binary` and `truncated`). Returns 404 when the file does not exist at the ref. Static sites always have a `privateGit` or `publicGit` source; the 422 response only occurs if the repository URL is missing.



## OpenAPI

````yaml https://api.sevalla.com/v3/openapi.json get /static-sites/{id}/repository/contents
openapi: 3.1.0
info:
  title: Sevalla API docs
  version: 1.0.0
servers:
  - url: https://api.sevalla.com/v3
security:
  - bearerAuth: []
paths:
  /static-sites/{id}/repository/contents:
    get:
      tags:
        - Static sites
      summary: Read static site repository file
      description: >-
        Read the contents of a single file from the static site Git repository
        at a given ref. Defaults to the commit of the latest successful
        deployment so you read exactly the code that is deployed. Binary files
        and files larger than 1 MB return metadata only with a null `content`
        (check `is_binary` and `truncated`). Returns 404 when the file does not
        exist at the ref. Static sites always have a `privateGit` or `publicGit`
        source; the 422 response only occurs if the repository URL is missing.
      operationId: getStaticSiteRepositoryFileV3
      parameters:
        - schema:
            type: string
            minLength: 1
            example: src/index.ts
          in: query
          name: path
          required: true
          description: Path of the file to read, relative to the repository root.
        - schema:
            example: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0
            type: string
          in: query
          name: ref
          required: false
          description: >-
            Branch, tag, or commit SHA to read the file at. Defaults to the
            commit of the latest successful deployment, falling back to the
            default branch when there is no such deployment or the static site's
            repository was changed after it (so the deployed commit no longer
            exists in the current repo).
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            example: fb5e5168-4281-4bec-94c5-0d1584e9e657
          in: path
          name: id
          required: true
          description: Static site identifier
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  path:
                    type: string
                    description: Path of the file relative to the repository root
                    example: src/index.ts
                  ref:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      The ref the file was read at (the resolved commit SHA or
                      branch)
                    example: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0
                  content:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      UTF-8 file content. Null when the file is binary or
                      exceeds the 1 MB size limit.
                    example: export const main = () => console.log('hello')
                  size:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: 'null'
                    description: File size in bytes
                    example: 1024
                  is_binary:
                    type: boolean
                    description: >-
                      Whether the file was detected as binary. Binary files do
                      not return content.
                    example: false
                  truncated:
                    type: boolean
                    description: >-
                      Whether content was omitted because the file exceeds the 1
                      MB size limit
                    example: false
                required:
                  - path
                  - ref
                  - content
                  - size
                  - is_binary
                  - truncated
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Unauthorized
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 401
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Forbidden
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 403
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Not found
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 404
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Unprocessable entity
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 422
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Too many requests
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 429
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Internal Server Error
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 500
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Pass your API key as a Bearer token in the
        Authorization header.

````