# OpenAi Api Pdf reader for Java

**URL:** <https://community.openai.com/t/openai-api-pdf-reader-for-java/957462>\
**Category:** API\
**Tags:** api, assistants-api, java, simple-openai\
**Created:** [September 26, 2024, 1:05pm UTC](https://community.openai.com/t/openai-api-pdf-reader-for-java/957462 "2024-09-26T13:05:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skylark839](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/skylark839/32/468440_2.png) [@Skylark839](https://community.openai.com/u/Skylark839)\
**Post date:** [September 26, 2024, 1:05pm UTC](https://community.openai.com/t/openai-api-pdf-reader-for-java/957462/1 "2024-09-26T13:05:57Z")

</div>

I’m currently working on a Java web application using Spring Boot, where I need to upload a PDF and extract specific information from it. I’m trying to use OpenAI for this task, but I’m struggling to find enough documentation for Java, particularly on how to upload files. I found that OpenAI supports Vector Store and Assistant APIs for file uploads and information retrieval, but I’m not entirely sure how to implement this, especially with Java.

Does anyone know how I can achieve this or have any documentation/resources that could help me complete this request?

---

<div class="post-metadata">

**Author:** ![platypus](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/platypus/32/759972_2.png) [@platypus](https://community.openai.com/u/platypus)\
**Post date:** [September 26, 2024, 3:51pm UTC](https://community.openai.com/t/openai-api-pdf-reader-for-java/957462/2 "2024-09-26T15:51:58Z")

</div>

Hi @Skylark839 and welcome to the community!

I did a quick search and found [this Java package](https://github.com/TheoKanning/openai-java), but looks like it’s been archived.

However, all OpenAI API examples, including Assistants API work with standard `curl` (HTTP) requests. So any Java library that is able to behave like `curl` equivalent (sending HTTP requests to some URI), should work fine.

For example, on [this page](https://platform.openai.com/docs/assistants/deep-dive/creating-assistants), you can see how to do everything by selecting “curl” option. To upload a file for example, you would do this:

```auto
curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F purpose="assistants" \
  -F file="@revenue-forecast.csv"

```

I am not up to speed with all the Java web features but any Java lib/module that can execute that should be good to go.

---

<div class="post-metadata">

**Author:** ![sashirestela](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/sashirestela/32/191115_2.png) [@sashirestela](https://community.openai.com/u/sashirestela)\
**Post date:** [September 30, 2024, 7:21pm UTC](https://community.openai.com/t/openai-api-pdf-reader-for-java/957462/3 "2024-09-30T19:21:35Z")

</div>

@Skylark839 Welcome to this community!

If you need to work with the Assistant API in Java, you could try this library:

> [@Simple-OpenAI: The OpenAI Java Client](https://community.openai.com/t/simple-openai-the-openai-java-client/348235):
>
> Let me introduce Simple OpenAI a Java http client library for sending requests to and receiving responses from the [OpenAI Api](https://platform.openai.com/docs/api-reference). It exposes a consistent interface across all the services, yet as simple as you can find in other languages like Python or NodeJs. Simple-OpenAI uses the [CleverClient](https://github.com/sashirestela/cleverclient) library for http communication, [Jackson](https://github.com/FasterXML/jackson) for Json parsing, and [Lombok](https://projectlombok.org/) to minimize boilerplate code.
