I am trying to create an openAiApi credentials using the public rest api. I have made a request to “/api/v1/credentials/schema/” endpoint to retrieve the required values and it only returns “apiKey”. However, when I try to create the credential using the POST on “/api/v1/credentials/”, I get the following error:
{
“message”: “request.body.data does not match allOf schema [subschema 0] with 4 error[s]:,request.body.data does not match allOf schema [subschema 0] with 1 error[s]:,request.body.data requires property “headerName”,request.body.data does not match allOf schema [subschema 1] with 1 error[s]:,request.body.data requires property “headerValue””
}
@afavar the issue is that your request body is missing the headerName and headerValue properties that the n8n API expects for the OpenAI credential type.
It does work! But the problem is I want to rely on the schema api and the response I got from the api does not mention about these two extra properties as required.
Edit: It does also work if I set the header property to false but I guess omitting it should be also working.
I don’t understand, the schema is returned by the n8n API itself, it is not my schema. Looking at that schema, only required root field is the “apiKey”. However, doing so results with an error upon creating the credential.
api/v1/credentials/schema/openAiApi
Isn’t the point of this endpoint to provide required information for programatic credential creation?