URL for local files

Hi Everyone,

Recently i joined this forum, I want to extract JSON text from a PDF file via Free OCR API. How to specify URL for local files (Drive C: D: …)?
I experimented via Postman (GET) but without success


For local files you can not use the GET method. The GET method works only if you have uploaded the PDF somewhere, and you have a URL to it.

=> Use the POST method.

Many thanks, I have got message for POST https://api.ocr.space/parse/imageurl?apikey=myAPIkey
“The requested resource doesnt support http method ‘POST’”, even when I use url=http://xxxx"
Can I get JSON text from local PDF file using this Free OCR API? Please advice
BRGS Miloslav

If it’s a local file and using POST then it wouldn’t be a URL, it would be your path.


Many thanks to all,
I have succeeded POST in Postman, working :grinning: :grinning:
Now I am fighting with WinHTTPRequest string, ResponseStatus is 200-OK,but filetype (pdf in my case) is not recognized - “Unable to recognize the file type”
.SetRequestHeader “Content-type”, “multipart/form-data”
.SetRequestHeader “filetype”, “pdf”
.SetRequestHeader “language”, “cze”
.SetRequestHeader “file”, “@/D:/SV/xxx.pdf”
Many thanks for advice, if possible…

What scripting language do you use?

Hi Admin, thanks
Microsoft Access VBA (reference MS WinHTTPServices 5.1)
Set objOCRHTTP = New WinHttpRequest
.Open “POST”, “https://api.ocr.space/parse/image”, False ‘’ & “?filetype=pdf”, False
.SetRequestHeader “apiKey”, “myAPIKeyxx”
.SetRequestHeader “Content-type”, “multipart/form-data”
.SetRequestHeader “filetype”, “pdf”
.SetRequestHeader “language”, “cze”
.SetRequestHeader “file”, “@/D:/SVJ/MyPDFFile.pdf”
.SetRequestHeader “iscreatesearchablepdf”, False
.SetRequestHeader “issearchablepdfhidetextlayer”, False
.SetRequestHeader “iscreatesearchablepdf”, False
.SetRequestHeader “istable”, True
end with
I also tried combination
.SetRequestHeader “filetype”, “pdf” and
& “?filetype=pdf” in POST string
Thanks again

This issue is fixed now. Please see OCR API filetype not detected

Dear Admin
Unable to Recognize the File Type message continues
Dim objOCRHTTP As New WinHttp.WinHttpRequest
.Open “POST”, “https://api.ocr.space/parse/image”, False
.SetRequestHeader “apiKey”, “MyAPIKeyString”
.SetRequestHeader “content-type”, “application/pdf”
.SetRequestHeader “language”, “cze”
.SetRequestHeader “file”, “/D:/SVJ/2020/2020FakturySVJ/Akus2019.pdf”
PoleTemp = .ResponseText
If .Status <> 200 Then
MsgBox .Status & " - " & .StatusText
End If
MsgBox PoleTemp
End With
OCR Response :
{“OCRExitCode”:99,“IsErroredOnProcessing”:true,“ErrorMessage”:[“Unable to recognize the file type”],“ProcessingTimeInMilliseconds”:“0”}
Experiencing with
.SetRequestHeader “filetype”, “PDF” has no effect

PostMan result is OK

So everything works when called with Postman?

Hi Admin, many thanks for your response
“So everything works when called with Postman?”
That is the correct question.
If I specify parameters under Body, everything is OK.
I tried to specify them under Params only (+ Authorisation ApiKey) and it is not working :hushed:, I have got the same message “Unable to recognize the file type”, see picture below.
The issue is if api.ocr.space…is able to accept this type of request.
In my WinHTTP I have only one option= SetRequestHeader, no option like …Body

Best regards