GitLab CI/CD files API

Operations about files

Operations 8

HEAD /api/v4/projects/{id}/repository/files/{file_path}/blame #
GET /api/v4/projects/{id}/repository/files/{file_path}/blame #
GET /api/v4/projects/{id}/repository/files/{file_path}/raw #
HEAD /api/v4/projects/{id}/repository/files/{file_path} #
GET /api/v4/projects/{id}/repository/files/{file_path} #
POST /api/v4/projects/{id}/repository/files/{file_path} #
PUT /api/v4/projects/{id}/repository/files/{file_path} #
DELETE /api/v4/projects/{id}/repository/files/{file_path} #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/gitlab-ci-files-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

gitlab-ci-files-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: GitLab access_requests Files API
  version: v4
  description: Operations related to access requests
servers:
- url: https://gitlab.com
tags:
- name: files
  description: Operations about files
paths:
  /api/v4/projects/{id}/repository/files/{file_path}/blame:
    head:
      description: Get blame file metadata from repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      - in: query
        name: ref
        description: The name of branch, tag or commit
        required: true
        example: main
        schema:
          type: string
      responses:
        '200':
          description: Get blame file metadata from repository
      tags:
      - files
      operationId: headApiV4ProjectsIdRepositoryFilesFilePathBlame
    get:
      description: Get blame file from the repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      - in: query
        name: ref
        description: The name of branch, tag or commit
        required: true
        example: main
        schema:
          type: string
      - in: query
        name: range[start]
        description: The first line of the range to blame
        required: true
        schema:
          type: integer
          format: int32
          minimum: 1
      - in: query
        name: range[end]
        description: The last line of the range to blame
        required: true
        schema:
          type: integer
          format: int32
          minimum: 1
      responses:
        '200':
          description: Get blame file from the repository
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/API_Entities_BlameRange'
      tags:
      - files
      operationId: getApiV4ProjectsIdRepositoryFilesFilePathBlame
  /api/v4/projects/{id}/repository/files/{file_path}/raw:
    get:
      description: Get raw file contents from the repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      - in: query
        name: ref
        description: The name of branch, tag or commit
        required: false
        example: main
        schema:
          type: string
      - in: query
        name: lfs
        description: Retrieve binary data for a file that is an lfs pointer
        required: false
        schema:
          type: boolean
          default: false
      responses:
        '200':
          description: Get raw file contents from the repository
          content:
            application/json:
              schema:
                type: string
                format: binary
      tags:
      - files
      operationId: getApiV4ProjectsIdRepositoryFilesFilePathRaw
  /api/v4/projects/{id}/repository/files/{file_path}:
    head:
      description: Get file metadata from repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      - in: query
        name: ref
        description: The name of branch, tag or commit
        required: true
        example: main
        schema:
          type: string
      responses:
        '200':
          description: Get file metadata from repository
      tags:
      - files
      operationId: headApiV4ProjectsIdRepositoryFilesFilePath
    get:
      description: Get a file from the repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      - in: query
        name: ref
        description: The name of branch, tag or commit
        required: true
        example: main
        schema:
          type: string
      responses:
        '200':
          description: Get a file from the repository
      tags:
      - files
      operationId: getApiV4ProjectsIdRepositoryFilesFilePath
    post:
      description: Create new file in repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      responses:
        '201':
          description: Create new file in repository
      tags:
      - files
      operationId: postApiV4ProjectsIdRepositoryFilesFilePath
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postApiV4ProjectsIdRepositoryFilesFilePath'
        required: true
    put:
      description: Update existing file in repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      responses:
        '200':
          description: Update existing file in repository
      tags:
      - files
      operationId: putApiV4ProjectsIdRepositoryFilesFilePath
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putApiV4ProjectsIdRepositoryFilesFilePath'
        required: true
    delete:
      description: Delete an existing file in repository
      parameters:
      - in: path
        name: id
        description: The project ID
        required: true
        example: gitlab-org/gitlab
        schema:
          type: string
      - in: path
        name: file_path
        description: The URL-encoded path to the file.
        required: true
        example: lib%2Fclass%2Erb
        schema:
          type: string
      - in: query
        name: branch
        description: Name of the branch to commit into. To create a new branch, also provide `start_branch`.
        required: true
        example: main
        schema:
          type: string
      - in: query
        name: commit_message
        description: Commit message
        required: true
        example: Initial commit
        schema:
          type: string
      - in: query
        name: start_branch
        description: Name of the branch to start the new commit from
        required: false
        example: main
        schema:
          type: string
      - in: query
        name: author_email
        description: The email of the author
        required: false
        example: johndoe@example.com
        schema:
          type: string
      - in: query
        name: author_name
        description: The name of the author
        required: false
        example: John Doe
        schema:
          type: string
      - in: query
        name: last_commit_id
        description: Last known file commit id
        required: false
        example: 2695effb5807a22ff3d138d593fd856244e155e7
        schema:
          type: string
      responses:
        '204':
          description: Delete an existing file in repository
      tags:
      - files
      operationId: deleteApiV4ProjectsIdRepositoryFilesFilePath
components:
  schemas:
    putApiV4ProjectsIdRepositoryFilesFilePath:
      type: object
      properties:
        file:
          type: string
          description: The file content to be updated (generated by Multipart middleware)
          format: binary
      required:
      - file
      description: Update existing file in repository
    postApiV4ProjectsIdRepositoryFilesFilePath:
      type: object
      properties:
        file:
          type: string
          description: The file content to be created (generated by Multipart middleware)
          format: binary
      required:
      - file
      description: Create new file in repository
    API_Entities_BlameRange:
      type: object
      properties:
        commit:
          $ref: '#/components/schemas/API_Entities_BlameRangeCommit'
        lines:
          type: array
          items:
            type: string
          example:
          - lorem ipsum
      required:
      - commit
      - lines
      description: API_Entities_BlameRange model
    API_Entities_BlameRangeCommit:
      type: object
      properties:
        id:
          type: string
          example: 2695effb5807a22ff3d138d593fd856244e155e7
        parent_ids:
          type: array
          items:
            type: string
          example:
          - 2a4b78934375d7f53875269ffd4f45fd83a84ebe
        message:
          type: string
          example: Initial commit
        authored_date:
          type: string
          format: date-time
          example: '2012-05-28T04:42:42-07:00'
        author_name:
          type: string
          example: John Smith
        author_email:
          type: string
          example: john@example.com
        committed_date:
          type: string
          format: date-time
          example: '2012-05-28T04:42:42-07:00'
        committer_name:
          type: string
          example: Jack Smith
        committer_email:
          type: string
          example: jack@example.com
      required:
      - id
      - parent_ids
      - message
      - authored_date
      - author_name
      - author_email
      - committed_date
      - committer_name
      - committer_email
  securitySchemes:
    access_token_header:
      type: apiKey
      name: PRIVATE-TOKEN
      in: header
    access_token_query:
      type: apiKey
      name: private_token
      in: query