# Replay a Decisions Playground request in the CLI Decisions answers classification questions about text or images. For example, it can route a support ticket, flag damage, and score severity in one request. 1. Open the [Decisions Playground](https://platform.openai.com/decisions) and configure a decision. 2. Open **Code** and select **JSON** in **View code**. 3. Click **Copy code**. 4. Paste the JSON into `request.json`. 5. Configure `OPENAI_API_KEY` with a key for the same project. 6. Replay the request in Bash or Zsh. Use the [PNG steps](#replay-an-exported-png) for an export with a PNG placeholder. ```bash OPENAI_UNTRUSTED_STDIN=true openai --format json decisions create < request.json ``` The shell reads the saved request from disk. `OPENAI_UNTRUSTED_STDIN=true` keeps strings starting with `@` literal. ## Replay an exported PNG Playground can export an uploaded PNG as `data:image/png;base64,...`. The `...` stands for the missing image bytes. For an export with one PNG placeholder, use Python 3 to insert the original PNG. The new request file contains the image bytes. Run this command in Bash or Zsh from a folder that supports hard links. Replace `image.png` with the path to the original PNG. ```sh python3 - request.json image.png request-with-image.json <<'PY' import base64 import json import os import sys from pathlib import Path from tempfile import TemporaryDirectory export_path, image_path, output_path = map(Path, sys.argv[1:]) request = json.loads(export_path.read_text(encoding="utf-8")) png_prefix = "data:image/png;base64," placeholders = [ part for message in request["input"] if isinstance(message, dict) and isinstance(message.get("content"), list) for part in message["content"] if part.get("type") == "input_image" and part.get("image_url", "").startswith("data:image/") and part.get("image_url", "").endswith(";base64,...") ] if len(placeholders) != 1 or placeholders[0]["image_url"] != png_prefix + "...": raise SystemExit("Expected one PNG placeholder in the request input.") image = image_path.read_bytes() if not image.startswith(b"\x89PNG\r\n\x1a\n"): raise SystemExit("Use the original PNG file from the Playground.") placeholders[0]["image_url"] = png_prefix + base64.b64encode(image).decode("ascii") os.umask(0o077) with TemporaryDirectory(dir=output_path.parent) as temp_dir: staged_path = Path(temp_dir) / "request.json" with staged_path.open("w", encoding="utf-8") as output: json.dump(request, output, indent=2) output.write("\n") os.link(staged_path, output_path) PY ``` After the command succeeds, replay `request-with-image.json`. ```sh OPENAI_UNTRUSTED_STDIN=true openai --format json decisions create < request-with-image.json ``` ## Try it with a sample ticket Save this example as `request.json`. ```json { "model": "gpt-6-luna", "input": "@support The screen arrived cracked. Can I get a replacement?", "questions": [ { "type": "choice", "name": "team", "instructions": "Which team should handle this ticket?", "choices": [{"value": "returns"}, {"value": "billing"}] }, { "type": "predicate", "name": "damaged", "instructions": "Does the ticket report damage?" }, { "type": "score", "name": "severity", "instructions": "How severe is the problem?", "levels": [{"label": "low"}, {"label": "high"}] } ] } ``` Replay the sample in Bash or Zsh. ```sh OPENAI_UNTRUSTED_STDIN=true openai --format json decisions create < request.json ``` The `answers` array follows the question order. If you named a question, its answer includes that `name`. For the routing question, read `answers[0].choice`. Check `answers[0].type` first because the model can refuse a question. See the [Decisions API guide](https://developers.openai.com/api/docs/guides/decisions) for answer types and supported inputs.