Error when trying to download a image using Dall-e API

After sending the prompt I received the url such:

I sanitize it and try to download, error. Put this in the browser and receive a message that public access denied, of course. (PublicAccessNotPermittedPublic access is not permitted on this storage account. RequestId:77806e57-601e-0049-043d-087542000000 Time:2022-12-05T00:07:34.2968187Z )

Well, what should I do from here? The process to generate the image is one, but to recover the image should be other, the only thing I have is the URL, how could I keep into that session to download the image? Any idea?

1 Like

Same error, I cannot access to my Image

Well, I quit using the URL and now I am using binary json to receive the images. I’ll suggest you doing the same.

1 Like

The image URL only lasts about an hour or so. It’s not meant for you to store them there long term.

Hope this helps!

Hey Paul, I know, but when I was still trying use the URL it was a kind of instant, after receive the URL is was already invalid. I am not expecting to store, but to download. So I move to use binary json and it works fine, though I had to convert it to a valid image.

Oops. Sorry. Good to hear.

Hi Magno,

I am getting the same error when I try to download the image using the url that is returned in the initial HTTP request to generate the image.

Can you tell me how you are doing the request/conversion with binary json to get around this?

Kinds regards

Well, I was unable to download the image created at the server-side, up today! So I move to download it as the binary json. Request is the same, setting ‘response_format’ as ‘b64_json’.

Depending on the language you are working it will be very different ways to convert from to a png bitmap image.

I am working in Swift version for Mac OS but I already have one done with Delphi to run my Android app, which nowadays using Delphi seems like not so common. For the sake of understanding my lib wrapper does such simple way to retrieve the files:

function TImages.DecodeJsonToFile(const Path: String): TArray<String>;
	i: integer;
	DecodedImage: TDecodedImage;
	ListDecodedImage: TArray<TDecodedImage>;
	ListDecodedImage := ExtractImageMeta();
	SetLength(Result, Length(ListDecodedImage));
	i := 0;
	for DecodedImage in ListDecodedImage do
		Result[i] := Path + DecodedImage.FileName;
		DecodeToFile(DecodedImage.B64Json, Path + DecodedImage.FileName);
  1. The ExtractImageMeta() function will get the name of files into an array, as you could had request more than 1 image to be generated.
  2. We loop the image array and decode file, storing the image in a path
  3. The function returns a full path name of all the images which were downloaded and decoded

As I stated the way to decode will be depended in which language you are using, but surely today maybe all the languages can easily decode 64 bit string into binary.

1 Like

Excellent thanks Magno… you have just unblocked me.

Going by the API documentation I thoughts I needed to chain a request to generate the image then follow up with another request to download the file. By setting the requested response to base 64, I got the actual image in the response and I could just decode the file from the payload and save it as a file on my server.

In case it helps anyone else the request from my Elixer app now looks like this:
body = Poison.encode!(%{
“prompt”: post_params[“body”],
“n”: 1,
“size”: “1024x1024”,
“response_format”: “b64_json”
headers = [{“accept”, “application/json”},{“Authorization”, “Bearer #{System.get_env(“API_KEY”)}”},{“Content-type”, “application/json”}]

ase, body, headers, [timeout: 50_000, recv_timeout: 50_000])

And the response from the request is like this:

{ “created” : “”, “data”: [{ “b64_json”: "asflknewlfadsknflknewlksandf…

Then saving it was easy:

    data =["data"], 0)
    random_string = Enum.random(1000..100000)
    File.write!("#{System.get_env("IMAGE_STORE")}/{random_string}.png", Base.decode64!(data["b64_json"]))

Thanks again Magno for taking the time to help me here. I dont think I would have figured it out on my own cause it wasnt clear from the documentation I was looking at here:

Its actually much better solution than what I was attempting anyway… still dont know why my original approach was working from localhost and not from my server.

Thank again


Error while download the images using Dall-E- API
hi everyone , i am trying to download using base64url, but its not getting download
can someone suggest me for the same ? i am building my app in React JS