Skip to content

Instantly share code, notes, and snippets.

@simonw
Created March 8, 2024 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonw/d6425fd997e61cf517aa196fe988638c to your computer and use it in GitHub Desktop.
Save simonw/d6425fd997e61cf517aa196fe988638c to your computer and use it in GitHub Desktop.

Setting up a ChatGPT Action to access Datasette Cloud

Actions schema. Modify simon.datasette.cloud to your own instance:

openapi: 3.0.1
info:
  title: Datasette API
  description: Execute SQL queries against a Datasette database and return the results as JSON
  version: v1
servers:
  - url: https://simon.datasette.cloud
paths:
  /data.json:
    get:
      operationId: query
      summary: Execute a SQLite SQL query against the data database
      description: Accepts SQLite SQL query, returns JSON. Does not allow PRAGMA statements.
      parameters:
        - name: sql
          in: query
          description: The SQL query to be executed
          required: true
          schema:
            type: string
        - name: _shape
          in: query
          description: The shape of the response data. Must be "array"
          required: true
          schema:
            type: string
            enum:
              - array
      responses:
        "200":
          description: Successful SQL results
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
        "400":
          description: Bad request
        "500":
          description: Internal server error

Set authentication to API key, Auth Type to Bearer and paste in a Datasette Cloud API key.

@simonw
Copy link
Author

simonw commented Mar 8, 2024

CleanShot 2024-03-08 at 07 21 38@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment