> For the complete documentation index, see [llms.txt](https://docs.autocontentapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autocontentapi.com/code-samples/data-tables/from-text-2.md).

# Java

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

public class CreateDataTable {
  public static void main(String[] args) throws Exception {
    String token = System.getenv().getOrDefault("AUTOCONTENT_TOKEN", "YOUR_API_TOKEN");
    String body = """
      {
        "outputType": "datatable",
        "resources": [
          {
            "type": "text",
            "content": "Company A raised $12M in Series A funding in Spain. Company B raised $35M in Series B funding in France."
          }
        ],
        "text": "Create columns for company, country, funding stage, funding amount, and positioning notes."
      }
      """;

    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(body))
      .build();

    HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
    if (response.statusCode() < 200 || response.statusCode() >= 300) {
      throw new RuntimeException("Request failed: " + response.statusCode() + "\n" + response.body());
    }

    System.out.println(response.body());
  }
}
```
