Custom GPT to send file to third party API (Own Server) in a post request

Hello,
I’m trying to make a custom GPT that calls a third parti API (Our Own Server), and sends it a document in a post request, to extract certain information which then I would tell GPT to process in a certain way.
I defined the API call as an action and explained how to fill the parameters and that it should send the file as a multipart/form-data but it fails. sometimes I see the request in the server logs but returns error 422.
The endpoint itself works fine, I’ve tested it with cURL Postman and swagger editor.
I’ve tried many times but it just doesn’t work and GPT doesn’t help much on why it is failing.
The action configuration:

openapi: "3.0.0"
info:
  title: Send a Document and a process it
  description: Sends a document to the server and process it
  version: 1.0.0
servers:
  - url: <server>
paths:
  /endpoint:
    post:
      description: Send a document and process it
      operationId: SendDocument
      parameters: []
      requestBody:
        description: document to be uploaded
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                customer:
                  type: string
                process:
                  type: string
                file:
                  type: string
                  format: binary
      responses:
        '201':
          description: Null response
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  headers:
    content-disposition:
      description: the content-disposition header
      schema:
        type: string
      required: true
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
3 Likes

ChatGPT doesn’t support sending multipart/form-data requests to your backend. It is not possible to upload files to a backend server via GPT Actions or Plugins right now, at best you can send a small base64 encoded string or a URL via a normal request, but neither of these will accomplish what I’m assuming you want to do.

2 Likes

I have the same issue. OpenAPI spec is:
“requestBody”: {
“content”: {
“multipart/form-data”: {
“schema”: {

what the server is receiving:
‘content-type’: ‘application/json’,

+1

I am also facing this issue and created a ticket fir the same - #577798