← API Reference

Language Guide · Java

Manage AI Prompts in Java

No SDK required. One HTTP call.

Fetch versioned, variable-interpolated AI prompts from Java using the built-in HttpClient (Java 11+). Works with Spring Boot, Quarkus, Micronaut, and any Jakarta EE stack.

Code Example

One function. Any AI provider.

Fetch a versioned, interpolated prompt from PromptForge with a single HTTP call. The returned content string passes directly to your AI SDK — no transformation, no adapter, no extra library.

  1. 1Fetch a versioned prompt by ID with your variable values.
  2. 2Receive the fully rendered content string in the response.
  3. 3Pass it directly to your AI provider SDK as the system prompt.
promptforge.java
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

import com.fasterxml.jackson.databind.ObjectMapper;

var client = HttpClient.newHttpClient();

var request = HttpRequest.newBuilder()
    .uri(URI.create(
        "https://www.promptforge-app.com/api/v1/prompts/YOUR_PROMPT_ID"
            + "?_version=latest&role=developer&task=review+code"
    ))
    .header("Authorization", "Bearer YOUR_API_KEY")
    .GET()
    .build();

var response = client.send(
    request,
    HttpResponse.BodyHandlers.ofString()
);

var json    = new ObjectMapper().readTree(response.body());
var content = json.get("content").asText();

// Pass content to any AI SDK

Why Java teams choose PromptForge

Designed for developers who want control without complexity.

No new Maven dependencies

java.net.http.HttpClient ships with the JDK since Java 11. If you already use Jackson for JSON, you need nothing extra in your pom.xml.

Spring-friendly by design

Inject the API key via @Value, call it from a @Service, or wire it into a RestTemplate/WebClient filter. Fits any Spring Boot architecture.

Works across every Java stack

The same HttpClient pattern works in Spring Boot, Quarkus, Micronaut, Jakarta EE, and plain main() applications without any framework coupling.

Integrate in 4 steps

From zero to fetching your first versioned prompt in under 10 minutes. No framework setup, no SDK installation — just HTTP.

  1. 1

    Create a prompt with variables

    Open the dashboard, click New Prompt, and write your system prompt using {{variable}} placeholders for any dynamic values.

  2. 2

    Copy your prompt ID

    Your prompt ID appears in the URL bar when editing: /dashboard/prompts/YOUR_PROMPT_ID. The API Usage panel also shows it with pre-filled examples.

  3. 3

    Generate an API key

    Go to the API settings page and click Generate Key. Store it in application.properties or an environment variable and inject with @Value.

  4. 4

    Call with java.net.http.HttpClient

    Build an HttpRequest with the Authorization header, send it synchronously or asynchronously, and parse the JSON body with Jackson. Pass the content string to your AI provider SDK.

Teams building AI features in Java

Java enterprise teams use PromptForge to give product managers direct control over AI prompts without requiring a code change or sprint ticket. The prompt lives outside the JAR — update it in the dashboard and the new version is live on the next request.

Start Free Trial
No SDK
required
1 call
to fetch any prompt
Instant
prompt updates
Any AI
provider supported

Start for free, upgrade anytime

No credit card required to get started. Paid plans include a 14-day free trial.

Developer Sandbox
Hobby Plan
$0/ forever
  • 1 Production Prompt
  • 1,000 API Requests/mo
  • Stable/Latest Channel Routing
  • No Credit Card Required
Launch Sandbox
Starter
14-day free trial
$9/month

No charge until your trial ends

  • 10k API requests/month
  • 5 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start 14-Day Free Trial
Most Popular
Pro
14-day free trial
$29/month

No charge until your trial ends

  • 100k API requests/month
  • 25 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start 14-Day Free Trial
Business
14-day free trial
$49/month

No charge until your trial ends

  • 500k API requests/month
  • 100 prompt
  • Unlimited versions
  • Dynamic variables
  • Version pinning
  • API key management
Start 14-Day Free Trial

Questions? Contact us