API error occurred: Status 401 {"detail":"API key is missing, please provide an API key in the header."}

Hello All,

I am running the Notebook on my Google Colab environement. I have imported all the librairies mentioned in the “requirements.txt” file successfully. I have been able to serialize the HTML and Powerpoint files into JSON correctly.

Now regarding the PDF file, I am facing an issue. I have reached the point to use the following code:

filename = “example_files/CoT.pdf”
with open(filename, “rb”) as f:
files=shared.Files(
content=f.read(),
file_name=filename,
)

req = shared.PartitionParameters(
files=files,
strategy=‘hi_res’,
pdf_infer_table_structure=True,
languages=[“eng”],
)
try:
resp = s.general.partition(req)
print(json.dumps(resp.elements[:3], indent=2))
except SDKError as e:
print(e)

I am getting the following error: API error occurred: Status 401
{“detail”:“API key is missing, please provide an API key in the header.”}

How can this be solved?

You need to get your own api keys for this to work and this is the place you will get from :point_down:t2:

Regards
DP