Connecting to Notion API bug with Notion-Version

Has anyone tried to connect to Notion’s API via a new GPT? It keeps saying “Invalid Notion-Version Header”, and no schema works.

3 Likes

Took quite a while but I got it to work like this:

YAML:

- in: header
  name: Notion-Version
  description: Specifies the version of Notion API to use
  required: true
  schema:
    type: string
    default: '2022-06-28'
    enum:
      - '2022-06-28'
      - '2022-02-22'
      - '2021-08-16'
      - '2021-05-13'
      - '2021-05-11'

JSON:

{
  "in": "header",
  "name": "Notion-Version",
  "description": "Specifies the version of Notion API to use",
  "required": true,
  "schema": {
    "type": "string",
    "default": "2022-06-28",
    "enum": [
      "2022-06-28",
      "2022-02-22",
      "2021-08-16",
      "2021-05-13",
      "2021-05-11"
    ]
  }
}

I got these two API-actions to work:

openapi: 3.1.0
info:
  title: xxx
  description: xxx
  version: v0.0.1
servers:
  - url: https://api.notion.com/v1
paths:
  /pages/{page_id}:
    get:
      description: Get page data
      operationId: getPage
      parameters:
        - in: header
          name: Notion-Version
          description: Specifies the Notion-Version
          required: true
          schema:
            type: string
            default: 2022-06-28
            enum:
              - 2022-06-28
              - 2022-02-22
              - 2021-08-16
              - 2021-05-13
              - 2021-05-11
      deprecated: false
      responses:
        "200":
          description: Details of the Page
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Page"
components:
  schemas:
    Page:
      type: object
      properties:
        id:
          type: string
        created_time:
          type: string
          format: date-time
        last_edited_time:
          type: string
          format: date-time
        title:
          type: string
        properties:
          type: object
          additionalProperties: true
paths:
  '/databases/{database_id}/query':
    post:
    ...

But I still haven’t figured out how to:

  1. Get Block/Page-Content in Rich-Text (only getting (Parent-)Page properties so far)
  2. Create/Append/Update a new Block/Page/DB

Anyone figured this out yet?
Any advice?

1 Like

Hey! Did you ever get this working with the reset of the API?