GPTS Authentication APIKEY

When I use gpts builder to create my own gpt, I need to call external api data, so I wrote an actions schema and my api validation is as follows: “components”: {
“securitySchemes”: {
“apiKeyAuth”: {
“type”: “apiKey”,
“in”: “query”,
“name”: “key”
}No matter how I choose Authentication, I can’t make my api communicate normally. Is there any way to solve this? Thank you.

1 Like

What type of error are you getting? Are you trying the “test” on the action?

You need to know how the API is normally invoked. You will likely need to identify the API key parameter, choose “custom,” and match the parameter.

If you have the documentation for the API you are calling it will likely include a few code examples for making an authenticated request.

The most straightforward to understand is a curl call, so I’d look for that first.

If you share what API you’re attempting to connect to people will be able to help more.


Also, authentication isn’t handled in the schema, there’s a setting you need to adjust to choose how to authenticator with an API key.

/search?key=&domain= This is my api link format. The apikey is passed through query. I have used custom in Authentication but it still cannot be used normally. The api returns no apikey. It can be used normally in the header in other api, but currently I cannot modify the verification method of the API.

I see…

Typically API keys are sent in headers, not in the URL string.

The only way I can see presently to get this API to work would be to hard-code it into the URL for each endpoint.

I would at least test that to ensure it works, but that’s never going to be secure, any user of your GPT will be able to acquire your API key if properly motivated.

The only other thing I can think of would be to set up an API relay/proxy on a machine you control. Basically, your machine accepts an API call with a secure key, makes the call to the API itself, then forwards the response back to the GPT.

If you share the service you are using I could try to look into it more for you later today or tomorrow.