How do I get the Image endpoint working with Postman?

I am getting it to download images with curl like…

curl \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer ...' \
  -d '{
  "prompt": "A cute baby sea otter",
  "n": 2,
  "size": "1024x1024"

But when I try to do the same with postman I get the error…

    "error": {
        "message": "Invalid URL (POST /v1/images/generation)",
        "type": "invalid_request_error",
        "param": null,
        "code": null

My request looks like this…

    "prompt": "Jackie R. Gleason as a spaceman",
    "n": 4,
    "size": "512x512"

Hey @jackiegleason, this is super nonintuitive but the issue is the R. in the prompt. If you omit the period, it will work fine, I just tested it locally. I will try to find out why this is the case and see if we can improve the docs at all here. Thanks for asking this!


Hm, odd, now I am able to get it work with the period included. I will continue to look into this!

1 Like

Yeah, I was gonna say that’s an odd one.

The error message infers it’s not getting the full openai URL, but I’m not that familiar with Postman.

Maybe it’s the way Postman sends authentication?

My gut says this is a weird intermittent failure but I am trying to diagnose further to be sure.

1 Like

Having a similar problem when the search prompt includes a hyphen. It works if I remove the hyphen.

“error”: {
“code”: null,
“message”: “Not allowed to GET on /v1/images/generations. (HINT: Perhaps you meant to use a different HTTP method?)”,
“param”: null,
“type”: “invalid_request_error”

Hey hi, I’ve just started exploring OpenAI models and to me, it is working pretty fine in postman so far, all 3 ImageModels, in can help if you need.