Custom Header / Authentication Issues

Today I tried Custom ChatGPT with the API’s from Toggle Track and Notion.so. I chose a single get Endpoint and wanted to retrieve Data.

Let’s go at first through the toggle track try:

The following API Schema and the correct API Token ends in an error code 403.

{
  "openapi": "3.1.0",
  "info": {
    "title": "Toggl Track API",
    "version": "1.0.0",
    "description": "API for accessing Toggl Track time entry data. This API requires Basic Authentication for all endpoints."
  },
  "servers": [
    {
      "url": "https://api.track.toggl.com/api/v9/me"
    }
  ],
  "paths": {
    "/time_entries": {
      "get": {
        "summary": "Get Time Entries",
        "description": "Retrieve a list of time entries. This endpoint requires Basic Authentication.\nProvide a valid username and password in the request header.\n",
        "operationId": "getTimeEntries",
        "parameters": [
          {
            "name": "start_date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of time entries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TimeEntry"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid Basic Authentication credentials."
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "TimeEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "description": {
            "type": "string"
          },
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "format": "date-time"
          },
          "duration": {
            "type": "integer"
          },
          "project_id": {
            "type": "integer"
          },
          "task_id": {
            "type": "integer"
          },
          "billable": {
            "type": "boolean"
          }
        }
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "Basic Authentication is used for this API. Provide the username and password encoded in Base64 in the Authorization header.\n"
      }
    }
  }
}

Let’s go through the second try with Notion:

Notion requires a custom Header about Notion-Version for retrieving information. The Custom GPT Console gave this warning:

In path /pages/{pageId}, method get, operationId getPageById, parameter Notion-Version has location header; ignoring

For the following openapi schema:

openapi: 3.1.0
info:
  title: Notion API
  version: 1.0.0
  description: API for accessing Notion pages and data
servers:
  - url: https://api.notion.com/v1

paths:
  /pages/{pageId}:
    get:
      summary: Get a Page
      description: Retrieve a specific page from Notion by its ID.
      operationId: getPageById
      parameters:
        - name: pageId
          in: path
          required: true
          description: Unique identifier for the page
          schema:
            type: string
        - name: Notion-Version
          in: header
          required: true
          description: The version of the Notion API being used for all requests
          schema:
            type: string
            default: '2022-06-28'
      responses:
        '200':
          description: Details of the Notion page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page'
        '401':
          description: Unauthorized - Invalid or missing API key.
        '404':
          description: Not Found - The page with the given ID was not found.
        '500':
          description: Internal server error
      security:
        - ApiKeyAuth: []

components:
  schemas:
    Page:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        content:
          type: string
          description: The content of the page in a specific format, e.g., Markdown or HTML.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

So it was not possible to retrieve any data.

Has somebody a solution for this to usecases or faces the same problems ?

Best Regards :slightly_smiling_face:

WOuld be keen to know this as well.

Did you found solution?

I encounter the same issue. I tested my OpenAPI spec for Notion in SwaggerHub. There I could retrieve my data. Unfortunately I also could not find a workaround. For the time being I switched to Airtable to get access to a database API. It serves my purpose well. Hopefully the OpenAI team will address this issue soon.

1 Like