OpenAPI Specification
openapi: 3.1.0
info:
title: Google Colab Notebooks via Drive Files API
description: Colab notebooks are stored as Google Drive files with the MIME type application/vnd.google.colaboratory. This API specification covers the Google Drive v3 endpoints commonly used to manage Colab notebooks, including listing, creating, updating, and sharing notebooks.
version: v3
contact:
name: Google Developers
url: https://developers.google.com/drive
termsOfService: https://cloud.google.com/terms
servers:
- url: https://www.googleapis.com/drive/v3
description: Google Drive API v3
security:
- oauth2: []
tags:
- name: Files
description: Notebook file operations
paths:
/files:
get:
operationId: listNotebooks
summary: Google Colab List Colab notebooks
description: Lists Colab notebooks in Google Drive. Use the q parameter with mimeType='application/vnd.google.colaboratory' to filter for notebook files.
tags:
- Files
parameters:
- name: q
in: query
description: Query string for filtering (e.g. mimeType filter for Colab files)
schema:
type: string
default: mimeType='application/vnd.google.colaboratory'
- name: pageSize
in: query
description: Maximum number of files to return
schema:
type: integer
minimum: 1
maximum: 1000
- name: pageToken
in: query
description: Token for next page of results
schema:
type: string
- name: fields
in: query
description: Fields to include in the response
schema:
type: string
- name: orderBy
in: query
description: Sort order (e.g. modifiedTime desc)
schema:
type: string
responses:
'200':
description: List of Colab notebook files
content:
application/json:
schema:
$ref: '#/components/schemas/FileList'
'401':
description: Unauthorized
post:
operationId: createNotebook
summary: Google Colab Create a Colab notebook
description: Creates a new Colab notebook in Google Drive by uploading metadata with the Colab MIME type.
tags:
- Files
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/File'
responses:
'200':
description: Notebook created
content:
application/json:
schema:
$ref: '#/components/schemas/File'
'400':
description: Invalid request
/files/{fileId}:
get:
operationId: getNotebook
summary: Google Colab Get notebook metadata
description: Retrieves metadata for a Colab notebook file.
tags:
- Files
parameters:
- $ref: '#/components/parameters/fileId'
- name: fields
in: query
schema:
type: string
responses:
'200':
description: Notebook file metadata
content:
application/json:
schema:
$ref: '#/components/schemas/File'
'404':
description: File not found
patch:
operationId: updateNotebook
summary: Google Colab Update notebook metadata
description: Updates the metadata of a Colab notebook file.
tags:
- Files
parameters:
- $ref: '#/components/parameters/fileId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/File'
responses:
'200':
description: Notebook updated
content:
application/json:
schema:
$ref: '#/components/schemas/File'
delete:
operationId: deleteNotebook
summary: Google Colab Delete a notebook
description: Permanently deletes a Colab notebook file.
tags:
- Files
parameters:
- $ref: '#/components/parameters/fileId'
responses:
'204':
description: Notebook deleted
'404':
description: File not found
/files/{fileId}/copy:
post:
operationId: copyNotebook
summary: Google Colab Copy a notebook
description: Creates a copy of a Colab notebook, useful for templating workflows.
tags:
- Files
parameters:
- $ref: '#/components/parameters/fileId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/File'
responses:
'200':
description: Notebook copied
content:
application/json:
schema:
$ref: '#/components/schemas/File'
components:
schemas:
File:
type: object
properties:
id:
type: string
readOnly: true
name:
type: string
description: The notebook file name
mimeType:
type: string
description: MIME type (application/vnd.google.colaboratory for Colab notebooks)
default: application/vnd.google.colaboratory
description:
type: string
parents:
type: array
items:
type: string
description: Parent folder IDs
createdTime:
type: string
format: date-time
readOnly: true
modifiedTime:
type: string
format: date-time
readOnly: true
owners:
type: array
readOnly: true
items:
type: object
properties:
displayName:
type: string
emailAddress:
type: string
webViewLink:
type: string
format: uri
readOnly: true
starred:
type: boolean
trashed:
type: boolean
FileList:
type: object
properties:
files:
type: array
items:
$ref: '#/components/schemas/File'
nextPageToken:
type: string
kind:
type: string
default: drive#fileList
parameters:
fileId:
name: fileId
in: path
required: true
description: The ID of the notebook file
schema:
type: string
securitySchemes:
oauth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://accounts.google.com/o/oauth2/auth
tokenUrl: https://oauth2.googleapis.com/token
scopes:
https://www.googleapis.com/auth/drive: Full Drive access
https://www.googleapis.com/auth/drive.file: Per-file access
externalDocs:
description: Google Drive API Reference
url: https://developers.google.com/drive/api/reference/rest/v3