context.Context and get back typed structs — authentication,
request building, and JSON (de)serialization are handled for you. It runs on the standard
library’s net/http, so it pulls in no third-party HTTP stack.
Requirements
- Go 1.22 or newer
Installation
Set up the client
Create an API key in Settings, then construct the client once and reuse it (it is safe for concurrent use):https://promptjuggler.com. Point the SDK at another host
(e.g. for testing) with promptjuggler.WithBaseURL(url), or swap the HTTP client (timeouts,
proxy) with promptjuggler.WithHTTPClient(h).
Per-endpoint usage
Every endpoint in the API reference includes a Go SDK code sample showing the exact call — that’s the place to look for how to invoke each operation and what it returns. Typed models are returned from theclient sub-package. A typical flow:
RunPrompt / RunWorkflow:
Error handling
When the API responds with an error status, the SDK returns an*APIError carrying the HTTP
status code and the server’s message. When the request never reaches the API (DNS failure,
timeout, offline), it returns a *NetworkError. If the API replies with a success status whose
body can’t be decoded (schema drift, an unknown enum value), it returns a *DecodeError. Match
them with errors.As:
Webhooks
PromptJuggler signs every webhook with thePromptJuggler-Signature header. Verify it against
the raw request body, before any JSON parsing:
VerifyWebhookSignature recomputes the HMAC-SHA256 of {timestamp}.{raw_body}, compares it in
constant time, and rejects deliveries whose timestamp falls outside a tolerance window
(default 300s) to prevent replay. A missing (empty) signature header returns false. Use
VerifyWebhookSignatureAt to supply an explicit tolerance and clock.