# Java

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String token = System.getenv().getOrDefault("AUTOCONTENT_TOKEN", "YOUR_API_TOKEN");

        String payload = """
{
  "outputType": "audio",
  "resources": [
    {
      "type": "website",
      "content": "https://autocontentapi.com"
    },
    {
      "type": "text",
      "content": "74% of businesses expect AI to increase productivity"
    }
  ],
  "text": "Explain why automating with AutoContent API is a game changer for any business"
}
""";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.autocontentapi.com/content/Create"))
                .header("Authorization", "Bearer " + token)
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(payload))
                .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

For focused recipes, explore the [podcast examples](/code-samples/podcasts/java.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.autocontentapi.com/code-samples/language-quickstarts/java.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
