> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parallel.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Decisions

> Answer typed questions using current web evidence.



## OpenAPI

````yaml /public-openapi.json post /v1/decisions
openapi: 3.1.0
info:
  title: Parallel API
  description: Parallel API
  contact:
    name: Parallel Support
    url: https://parallel.ai
    email: support@parallel.ai
  version: 0.1.2
servers:
  - url: https://api.parallel.ai
    description: Parallel API
security:
  - ApiKeyAuth: []
tags:
  - name: Search
    description: >-
      Search returns ranked URLs with extended excerpts suitable for LLM
      consumption. Inputs are a natural-language objective and optional keyword
      queries. Source policies allow including or excluding specific domains and
      have configurable output sizes. The returned extended snippets contain
      dense, relevant information from relevant pages.

      - Result: ranked list with URL, title, and long text excerpts
  - name: Image Search
    description: >-
      Image Search returns ranked images from the web. Inputs are keyword
      queries and an optional natural-language objective. `fast`: lowest latency
      and cost. `advanced` (default): slower, with higher-quality results.

      - Result: title, direct image URL, source page URL, and dimensions
  - name: Extract
    description: >-
      Extract returns excerpts or full content from one or more URLs. Inputs are
      a list of URLs and an optional search objective and keyword queries. The
      returned excerpts or full content is formatted as markdown and suitable
      for LLM consumption.

      - Result: excerpts or full content from the URL formatted as markdown
  - name: Decisions
    description: >-
      Answer typed choice, score, and probability questions using current web
      evidence, with shared citations for the request.
  - name: Tasks
    description: >-
      The Task API executes web research and extraction tasks. Clients submit a
      natural-language objective with an optional input schema; the service
      plans retrieval, fetches relevant URLs, and returns outputs that conform
      to a provided or inferred JSON schema. Supports deep research style
      queries and can return rich structured JSON outputs. Processors trade-off
      between cost, latency, and quality. Each processor supports calibrated
      confidences.

      - Output metadata: citations, excerpts, reasoning, and confidence per
      field


      Task Groups enable batch execution of many independent Task runs with
      group-level monitoring and failure handling.

      - Submit hundreds or thousands of Tasks as a single group

      - Observe group progress and receive results as they complete

      - Real-time updates via Server-Sent Events (SSE)

      - Add tasks to an existing group while it is running

      - Group-level retry and error aggregation
  - name: FindAll
    description: >-
      The FindAll API discovers and evaluates entities that match complex
      criteria from natural language objectives. Submit a high-level goal and
      the service automatically generates structured match conditions, discovers
      relevant candidates, and evaluates each against the criteria. Returns
      comprehensive results with detailed reasoning, citations, and confidence
      scores for each match decision. Streaming events and webhooks are
      supported.
  - name: Monitor
    description: >-
      The Monitor API watches the web for material changes on a fixed frequency.
      Each monitor runs once on creation and then on its configured schedule,
      emitting events when meaningful changes are detected.

      - `event_stream` monitors track a search query and emit an event for each
      new material change.

      - `snapshot` monitors track a specific task run's output and emit an event
      when the output changes.


      Results can be polled via the events endpoint or delivered via webhooks.
  - name: Memory
    description: >-
      The Memory API retrieves and manages memories created by Tasks, Monitors,
      and FindAll runs. Memories can be personal or isolated with a
      `memory_scope_key`.
  - name: Chat API (Beta)
    description: >-
      The Chat API provides a programmatic chat-style text generation interface.
      It accepts a sequence of messages and returns model responses. Intended
      for assistant-like interactions and evaluation. Streaming responses are
      supported.
  - name: Responses API
    description: >-
      An OpenAI-Responses-compatible interface for answers grounded in live web
      research, with URL citations. Point any Responses-API client — the OpenAI
      Python SDK, OpenAI TypeScript SDK, the Agents SDK, or raw HTTP — at
      `https://api.parallel.ai` with your Parallel API key, set `model` to
      `parallel`, and call `/v1/responses`.

      - `input` accepts a plain string or an array of role/content messages
      (canonical OpenAI shape; text content only).

      - `reasoning.effort` (`low`/`medium`/`high`/`auto`) controls how much
      research is performed, trading response time for answer quality.

      - Multi-turn via `previous_response_id`.

      - Structured outputs via `text.format = {"type": "json_schema", "name":
      ..., "schema": {...}}`.

      - Streaming (`stream=true`) emits the standard OpenAI Responses SSE
      lifecycle: `response.created` and `response.in_progress`, then output item
      / content part / text delta events with URL-citation annotations, the
      matching `*.done` events, and a terminal `response.completed` — or
      `response.failed` if the request fails mid-stream.
paths:
  /v1/decisions:
    post:
      tags:
        - Decisions
      summary: Decisions
      description: Answer typed questions using current web evidence.
      operationId: grounded_decisions_v1_decisions_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroundedDecisionRequest'
            example:
              state:
                company: Clay
                website: https://www.clay.com
              questions:
                has_cli:
                  type: noul
                  instructions: Does Clay offer an official command-line interface (CLI)?
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroundedDecisionResponse'
              examples:
                live:
                  summary: Captured response from a live request.
                  value:
                    mode: fast
                    answers:
                      has_cli:
                        type: noul
                        noul: 0.9992643798509062
                    usage:
                      input_tokens: 4212
                      output_tokens: 0
                    citations:
                      - url: https://developers.clay.com/concepts/cli-basics
                        title: CLI basics
                        excerpts:
                          - >-
                            Understand the Clay CLI output contract, exit codes,
                            environment variables, and authentication.

                            The Clay CLI (clay) is JSON-first: every command
                            writes machine-readable JSON to stdout on success
                            and a structured error envelope to stderr on
                            failure.

                            There are no spinners, colors, or progress bars, so
                            agents and scripts can branch on the output and exit
                            code directly.

                            clay login opens a browser to authorize the CLI with
                            OAuth — this works from a human terminal or an
                            agent's shell tool. Use clay whoami as the canonical
                            check that authentication is working, and clay
                            logout to clear a stored credential.

                            Each sign-in covers one workspace — the one you pick
                            on the consent screen.

                            To work across several, run clay login once per
                            workspace: signing into a second keeps the first.
                            clay workspaces list shows what you are signed into,
                            clay workspaces current shows which one commands run
                            against, and clay workspaces switch <id> switches.
                      - url: https://university.clay.com/docs/cli-security-privacy
                        title: CLI security & privacy - Clay Docs
                        excerpts:
                          - >-
                            Understand CLI authentication, role requirements,
                            and how Clay handles data sent from your terminal.

                            Overview

                            Clay's CLI lets your team drive a Clay workspace
                            from a terminal or coding agent instead of the UI.

                            Because that means credentials live on a local
                            machine and commands run outside the app, admins
                            need to know who can sign in and what those sessions
                            can reach.

                            ‍

                            Note: The CLI is part of Clay's Agent Plugin, which
                            is in open beta and currently supported on Mac and
                            Linux. Windows is not supported during the beta.

                            ‍

                            How CLI sessions are authenticated

                            The recommended path is browser-based OAuth:

                            Treat that file like any other credential on disk —
                            it is not stored in your operating system's
                            keychain.

                            * Running clay logout clears the stored credentials
                            for that machine.

                            API keys are for calling the Clay public API
                            directly — they don't sign in to the CLI.

                            The supporting documentation — the SOC 2 Type II
                            report, the current AI subprocessor list, and
                            security questionnaire responses — is available
                            through the Clay Trust Center , or by contacting
                            security@clay.com .

                            Your responsibilities:

                            * Decide who gets CLI access — CLI access implies
                            edit rights on the workspace. Grant Editor
                            deliberately.

                            How Clay handles data sent through the CLI

                            When your team runs a CLI command:

                            FAQs

                            If we drive the CLI from a coding agent, what does
                            that agent's provider see?

                            The CLI itself communicates only with Clay. But when
                            you run it through a coding agent, whatever you type
                            into that agent — and whatever command output it
                            reads back — is processed by that agent's provider
                            under your agreement with them, not Clay's.

                            * Do not sell my data

                            © Clay 2025 – Born in Brooklyn. Claymation
                            illustrations by the wonderful Hudson Christie .
                      - url: https://docs.clayplatform.io/claycli/docs/cli.html
                        title: Claycli · Clay CLI
                        excerpts:
                          - >-
                            Clay CLI ### 3.9.1

                            * GitHub

                            Claycli

                            This is the Clay command line utility. Here we will
                            provide you with documentation and examples that
                            will help you to run all the functionalities that
                            you need. ##  Installation To install claycli you
                            just need to type the following command: ``` $ npm
                            install -g claycli

                            Clay CLI ### 3.9.1

                            > [](#usage) Usage If installed globally, call
                            `clay` from the command line with the
                            [command](#commands) and `options` that you need.
                            ```

                            Clay CLI ### 3.9.1

                            $ clay < command > [options]

                            `Much like `git` ; `claycli` is configured using a
                            [dotfile](https://medium.com/@webprolific/getting-started-with-dotfiles-43c3602fd789)
                            ( `.clayconfig` ) in your home folder. In it, you
                            may specify references to api keys and `urls / site
                            prefixes` that you use frequently.

                            Clay CLI ### 3.9.1

                            For `urls` and `site prefixes` , it will assume
                            `http://` and port `80` unless you specify
                            otherwise. Note that a `_site prefix_` is everything
                            before the api route, e.g. `http://domain.com/site1`
                            in `http://domain.com/site1/_components/article` .`

                            [keys]

                            local  = ha8yds9a8shdf98asdf

                            qa  =  8 quwqwer09ewr0w9uer

                            Clay CLI ### 3.9.1

                            prod  = bj34b6345k634jnk63n4

                            [urls]

                            local-site1  = https://localhost.site1.com: 3001
                            local-site2  = site2.com/site- 2 # http and port 80

                            Clay CLI ### 3.9.1

                            ``` For smaller `Clay` installations (or,
                            ironically, for very large teams where devs spend
                            most of their time on individual sites), you may
                            specify a default api key and `url / site prefix` by
                            using the `CLAYCLI_DEFAULT_KEY` and
                            `CLAYCLI_DEFAULT_URL` environment variables. ##
                            [](#commands) Commands * [`config`](#config)

                            Clay CLI ### 3.9.1

                            * [`lint`](#lint)

                            * [`import`](#import)

                            * [`export`](#export)

                            * [`compile`](#compile)
                      - url: >-
                          https://university.clay.com/fr/docs/audiences-for-agents
                        title: Audiences for agents and the CLI - Clay Docs
                        excerpts:
                          - >-
                            Audiences for agents and the CLI

                            Read, segment, and manage your workspace's people,
                            companies, and deals from the Clay CLI — and from
                            the Clay agents that run it for you.

                            Overview

                            Audiences is the home for your workspace's own
                            people, companies, and deals.

                            The clay audiences command group brings those
                            records to your terminal: you can create and edit
                            segments, manage field definitions, count or read
                            records, and read the activities and signal events
                            attached to them — all without opening the Clay app.

                            ‍

                            Note: These commands need Audiences enabled for your
                            workspace, plus the Clay Agent Plugin installed and
                            signed in. Install and sign-in steps live in the
                            plugin doc, linked below.

                            ‍

                            * The Clay CLI — you or your coding agent run clay
                            audiences commands directly in a terminal.

                            * Sculptor — Clay's in-app go-to-market co-pilot
                            runs the same commands for you when you ask it about
                            your records.

                            * The Agent surface in Clay — runs the same commands
                            while it reasons through a play and builds the
                            workflow.

                            FAQs

                            Does reading Audiences from the CLI cost credits?

                            Not today — Audiences is CLI-only, and no MCP tool
                            serves it. Reps who connect a chat app to Clay over
                            MCP get people and company search plus any Functions
                            your team has enabled, and admins can additionally
                            let them query owned accounts and opportunity data
                            from the CRM. See MCP in Clay for how that access is
                            configured.

                            Do Clay's in-app agents really run the same
                            commands?

                            Yes. All three surfaces load the same Audiences
                            instructions from the Clay Agent Plugin, so a
                            capability that lands in the CLI reaches Sculptor
                            and the Agent surface with it. That's also why the
                            limitations above apply everywhere rather than to
                            the terminal alone.

                            How do I copy a segment?
                      - url: https://developers.clay.com/quickstart
                        title: Quickstart - Clay docs
                        excerpts:
                          - >-
                            Build with Clay from your coding agent, or call the
                            Clay API from your own applications.

                            There are two ways to use Clay as a developer:
                            install the agent plugin to build with Clay inside
                            your coding agent, or call the Public API directly
                            from your own applications and services.

                            Agent plugin

                            The agent plugin gives your coding agent Clay's
                            skills and the clay CLI — the fastest way to build
                            with Clay from a coding agent.

                            It requires a coding-agent host with a shell —
                            Claude Code, Codex, or Cursor — and doesn't work in
                            general-purpose chat apps like Claude Desktop,
                            claude.ai, or ChatGPT that can't run the CLI.

                            Copy this into your agent of choice and let it
                            install and set up the plugin for you:

                            Set up the Clay plugin by following the steps in

                            https://github.com/clay-run/agent-plugins

                            This runs the plugin's setup skill, which puts clay
                            on your PATH, signs you in, and verifies the CLI.
                            Sign-in opens a browser to authorize the CLI.

                            Agent plugin repository

                            API

                            Use the Public API to call Clay from your own
                            applications and services — backend jobs, internal
                            tools, queues, and product features. Requests
                            authenticate with a Clay API key in the clay-api-key
                            header.

                            API reference

                            Endpoint paths, request bodies, response schemas,
                            and an interactive try-it console.

                            Get an API key

                            * Ask your agent to generate one for you after
                            installing the agent plugin.

                            * Run clay api-keys create --name "<key name>" with
                            the clay CLI. The key is returned once, in the
                            apiKey field.

                            * Create one yourself in Clay under API and CLI →
                            API keys.

                            Keep keys server-side.
                      - url: https://www.clay.com/agent-plugin
                        title: >-
                          Clay CLI: Build on Clay with any coding agent |
                          clay.com
                        excerpts:
                          - >-
                            description: Use Clay's CLI to build workflows and
                            governance directly into your GTM system. Build in
                            Clay directly via a coding agent with CLI. title:
                            "Clay CLI: Build on Clay with any coding agent |
                            clay.com" image:
                            https://cdn.prod.website-files.com/61477f2c24a826836f969afe/6a4fbb2bf6b13e7ff04d15c7_open%20graph%20cli%20api.jpg

                            Agent plugin

                            Build on Clay with any coding agent

                            Use Clay's API to build Clay data, workflows, and
                            governance directly into your GTM system. Build in
                            Clay directly via a coding agent with CLI.

                            Install the Clay Plugin to start building

                            Copy and paste into your agent of choice

                            Set up the Clay plugin by following the steps in
                            https://github.com/clay-run/agent-plugins

                            Copied

                            Call any functions, workflows, and Claygents from
                            Clay's API so your coding agent references centrally
                            governed GTM logic — including lead scoring and
                            outbound copy — instead of rebuilding one-offs.

                            Get started

                            Use Case 03 — WORKFLOW AUTOMATION

                            Vibecode GTM workflows

                            Build workflows in natural language via Clay CLI,
                            then manage observability in-product, using Clay
                            Workflows.

                            Get started

                            Build on Clay with any coding agent

                            Install the Clay Plugin and start building data,
                            workflows, and governance into your GTM system.

                            Install the Clay Plugin to start building

                            Copy and paste into your agent of choice

                            Set up the Clay plugin by following the steps in
                            https://github.com/clay-run/agent-plugins

                            Copied

                            Developer docs

                            press Enter to run — press R to reset

                            {

                            "@context" : "https://schema.org",

                            "@type" : "WebSite",

                            "name" : "Clay",

                            "alternateName" : "Clay",

                            "url" : "https://clay.com/"

                            }
                      - url: >-
                          https://university.clay.com/docs/clay-api-cli?dub_id=DHFbP3TR3TaCG4pm
                        title: Installing Clay Plugin (API & CLI) - Clay Docs
                        excerpts:
                          - >-
                            Head to Guide: Using Clay Plugin for go-to-market
                            plays you can run once the Plugin is connected —
                            source your market, score it for fit, and route who
                            gets worked first.

                            ‍

                            Note: The Plugin installs Clay’s skills and the Clay
                            CLI into your coding agent.

                            For the full CLI quickstart, Public API setup, code
                            examples, and guides for Searches, Routines, and
                            Workflows, see developers.clay.com .

                            They're separate surfaces, not two halves of one
                            product. The Plugin installs Clay's skills and the
                            Clay CLI into your coding agent, and the CLI is what
                            you or your agent run in a shell for one-off runs,
                            scripting, and inspecting data. It authenticates
                            with the session created by clay login , so there's
                            no separate key to configure.

                            Can I build or write to Clay tables via CLI or API?

                            There are no current plans to support table building
                            from the API or CLI.

                            Can I build Workflows with the API or CLI?

                            Yes, Workflows are available from the CLI and Plugin
                            in Beta . For production use, Clay-managed functions
                            and custom functions are the more stable option.

                            Are credit budgets available via the developer
                            platform?

                            Use Company URL Finder in Clay to turn a company
                            name into that company's website domain.

                            View article

                            View article View article

                            Settings & admin

                            IP access restrictions

                            Read, segment, and manage your workspace's people,
                            companies, and deals from the Clay CLI — and from
                            the Clay agents that run it for you.

                            View article

                            View article View article

                            Other popular resources

                            Experts

                            Find a Clay Expert

                            Explore our network of Clay experts and agencies.

                            View experts

                            View experts View experts

                            Community

                            * Do not sell my data

                            © Clay 2025 – Born in Brooklyn. Claymation
                            illustrations by the wonderful Hudson Christie .
                      - url: https://developers.clay.com/
                        title: Overview - Clay docs
                        excerpts:
                          - >-
                            Use Clay from agents, terminals, backend services,
                            internal tools, and custom apps.

                            Clay used to live primarily in the Clay UI. Now Clay
                            also works where your agents, developers, and
                            business systems already are.

                            Use the developer platform to search Clay's GTM
                            data, run reusable Clay logic, read table data, and
                            work with Audiences programmatically.

                            Start here

                            Install the Clay plugin

                            Best for Claude Code, Codex, Cursor, and agent-first
                            work. The plugin ships skills and the Clay CLI.

                            Call the API directly

                            Best for backend jobs, internal tools, custom apps,
                            queues, and product workflows.

                            Core primitives

                            * Primitive | Use it for

                            * Searches | Find companies and people using Clay's
                            GTM database

                            * Routines | Run Clay-managed functions, custom
                            functions, and Workflows

                            * Tables (Enterprise) | Query existing Clay table
                            data from known tables

                            * Audiences | Work with records, saved segments,
                            activities, and signal events

                            Run a search, then enrich with a function

                            Pull a target list from Clay data, then run
                            Clay-managed functions on the results.

                            Give an agent access to a Clay function

                            Let an agent call Clay logic as part of its normal
                            work.

                            Build a Workflow (Alpha)

                            Create, edit, validate, run, and inspect a Workflow
                            from the plugin or CLI.
                      - url: https://university.clay.com/fr/docs/clay-api-cli
                        title: Installing Clay Plugin (API & CLI) - Clay Docs
                        excerpts:
                          - >-
                            Installing Clay Plugin (API & CLI)

                            Head to Guide: Using Clay Plugin for go-to-market
                            plays you can run once the Plugin is connected —
                            source your market, score it for fit, and route who
                            gets worked first.

                            ‍

                            Note: The Plugin installs Clay’s skills and the Clay
                            CLI into your coding agent.

                            * A paid coding agent plan: Claude (Pro, Max, Team,
                            or Enterprise) for Claude Code, or ChatGPT (Plus,
                            Pro, Business, Edu, or Enterprise) for Codex. If
                            your company manages Claude, check that Claude Code
                            is enabled for you.

                            * Editor or Admin access in the Clay workspace
                            you'll connect.

                            * On Windows, admin rights (or help from IT) for one
                            step.

                            ‍

                            * Plan | Search results per request | Total search
                            results

                            * Free | 50 | 100/mo

                            * Trial | 50 | 10k per 14 days

                            * Paid self-serve plans | 500 | 1M/yr

                            * Enterprise | 500 | 10M/yr

                            FAQs

                            Does using the API or CLI cost extra credits?

                            The Plugin gives agent environments (Claude Code,
                            Codex, Cursor) Clay's skills and the Clay CLI — the
                            fastest path for agent-first and interactive coding
                            workflows. The Public API is better suited for
                            background jobs and your own apps, where you want to
                            call Clay directly instead of installing anything.

                            The Public API uses its own key rather than your CLI
                            sign-in. Create one with the clay api-keys create
                            command — the key is shown only once, so store it
                            somewhere safe.

                            They're separate surfaces, not two halves of one
                            product. The Plugin installs Clay's skills and the
                            Clay CLI into your coding agent, and the CLI is what
                            you or your agent run in a shell for one-off runs,
                            scripting, and inspecting data. It authenticates
                            with the session created by clay login , so there's
                            no separate key to configure.

                            Can I build or write to Clay tables via CLI or API?

                            There are no current plans to support table building
                            from the API or CLI.
                      - url: https://university.clay.com/docs/clay-api-cli
                        title: Installing Clay Plugin (API & CLI) - Clay Docs
                        excerpts:
                          - >-
                            Head to Guide: Using Clay Plugin for go-to-market
                            plays you can run once the Plugin is connected —
                            source your market, score it for fit, and route who
                            gets worked first.

                            ‍

                            Note: The Plugin installs Clay’s skills and the Clay
                            CLI into your coding agent.

                            * A paid coding agent plan: Claude (Pro, Max, Team,
                            or Enterprise) for Claude Code, or ChatGPT (Plus,
                            Pro, Business, Edu, or Enterprise) for Codex. If
                            your company manages Claude, check that Claude Code
                            is enabled for you.

                            * Editor or Admin access in the Clay workspace
                            you'll connect.

                            * On Windows, admin rights (or help from IT) for one
                            step.

                            ‍

                            There is no additional cost to use the Plugin.

                            The Plugin also gives you access to:

                            * Audiences — Read and segment the workspace's own
                            people, companies, and deals. See Audiences for
                            agents and the CLI .

                            * Searches — Find companies and people using
                            structured filters over Clay's GTM dataset. Learn
                            more about Searches in this video walkthrough .

                            FAQs

                            Does using the API or CLI cost extra credits?

                            No. API and CLI calls consume the same credits and
                            actions as the equivalent work done in-product.
                            There is no additional cost because work is
                            triggered via the developer platform instead of the
                            UI.

                            What's the difference between the Plugin and the
                            Public API?

                            The Plugin gives agent environments (Claude Code,
                            Codex, Cursor) Clay's skills and the Clay CLI — the
                            fastest path for agent-first and interactive coding
                            workflows. The Public API is better suited for
                            background jobs and your own apps, where you want to
                            call Clay directly instead of installing anything.

                            The Public API uses its own key rather than your CLI
                            sign-in. Create one with the clay api-keys create
                            command — the key is shown only once, so store it
                            somewhere safe.

                            Can I build or write to Clay tables via CLI or API?
                    decision_id: decisions_34b4be1b1405e19ba5516d9bb76c56ad
        '422':
          description: Request validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  ref_id: <reference-id>
                  message: Request validation error.
      x-code-samples:
        - lang: Python
          source: |-
            import os

            import requests

            response = requests.post(
                "https://api.parallel.ai/v1/decisions",
                headers={"x-api-key": os.environ["PARALLEL_API_KEY"]},
                json={
                    "state": {
                        "company": "Clay",
                        "website": "https://www.clay.com",
                    },
                    "questions": {
                        "has_cli": {
                            "type": "noul",
                            "instructions": "Does Clay offer an official command-line interface (CLI)?",
                        }
                    },
                },
                timeout=30,
            )
            response.raise_for_status()
            decision = response.json()

            answer = decision["answers"]["has_cli"]
            if answer["type"] == "refusal":
                print("No decision returned; review this question.")
            else:
                print("Estimated probability:", answer["noul"])

            for citation in decision["citations"]:
                print(citation["url"])
        - lang: TypeScript
          source: |-
            async function main() {
                const response = await fetch("https://api.parallel.ai/v1/decisions", {
                    method: "POST",
                    headers: {
                        "Content-Type": "application/json",
                        "x-api-key": process.env.PARALLEL_API_KEY!,
                    },
                    body: JSON.stringify({
                        state: {
                            company: "Clay",
                            website: "https://www.clay.com",
                        },
                        questions: {
                            has_cli: {
                                type: "noul",
                                instructions: "Does Clay offer an official command-line interface (CLI)?",
                            },
                        },
                    }),
                });
                if (!response.ok) {
                    throw new Error(`Decision failed: ${response.status} ${await response.text()}`);
                }

                const decision = await response.json();
                const answer = decision.answers.has_cli;
                if (answer.type === "refusal") {
                    console.log("No decision returned; review this question.");
                } else {
                    console.log("Estimated probability:", answer.noul);
                }
                for (const citation of decision.citations) {
                    console.log(citation.url);
                }
            }

            main().catch(console.error);
        - lang: cURL
          source: |-
            curl https://api.parallel.ai/v1/decisions \
              -H "Content-Type: application/json" \
              -H "x-api-key: $PARALLEL_API_KEY" \
              -d '{
                "state": {
                  "company": "Clay",
                  "website": "https://www.clay.com"
                },
                "questions": {
                  "has_cli": {
                    "type": "noul",
                    "instructions": "Does Clay offer an official command-line interface (CLI)?"
                  }
                }
              }'
        - lang: Java
          source: |-
            import java.net.URI;
            import java.net.http.HttpClient;
            import java.net.http.HttpRequest;
            import java.net.http.HttpResponse;
            import java.time.Duration;

            public class DecisionsExample {
                public static void main(String[] args) throws Exception {
                    String body = "{"
                        + "\"state\":{\"company\":\"Clay\","
                        + "\"website\":\"https://www.clay.com\"},"
                        + "\"questions\":{\"has_cli\":{\"type\":\"noul\","
                        + "\"instructions\":\"Does Clay offer an official command-line interface (CLI)?\"}}}";

                    HttpRequest request = HttpRequest.newBuilder()
                        .uri(URI.create("https://api.parallel.ai/v1/decisions"))
                        .timeout(Duration.ofSeconds(30))
                        .header("Content-Type", "application/json")
                        .header("x-api-key", System.getenv("PARALLEL_API_KEY"))
                        .POST(HttpRequest.BodyPublishers.ofString(body))
                        .build();
                    HttpResponse<String> response = HttpClient.newHttpClient()
                        .send(request, HttpResponse.BodyHandlers.ofString());
                    if (response.statusCode() >= 400) {
                        throw new RuntimeException("Decision failed: " + response.statusCode()
                            + " " + response.body());
                    }
                    System.out.println(response.body());
                }
            }
components:
  schemas:
    GroundedDecisionRequest:
      properties:
        mode:
          type: string
          const: fast
          title: Mode
          default: fast
          description: Decision execution mode.
        state:
          $ref: '#/components/schemas/JsonValue'
          description: >-
            Context shared by all questions. Accepts any JSON value. Together
            with the largest question, this may use at most 32,000 estimated
            input tokens.
        questions:
          type: object
          maxProperties: 100
          title: Questions
          description: >-
            1–100 questions keyed by names containing only ASCII letters,
            numbers, underscores, and hyphens. State plus the largest question
            may use at most 32,000 estimated input tokens. Each value is a
            predicate (`noul`), choice, or score question.
          patternProperties:
            ^[A-Za-z0-9_-]+$:
              oneOf:
                - $ref: '#/components/schemas/GroundedChoiceQuestion'
                - $ref: '#/components/schemas/GroundedScoreQuestion'
                - $ref: '#/components/schemas/GroundedNoulQuestion'
              discriminator:
                propertyName: type
                mapping:
                  choice: '#/components/schemas/GroundedChoiceQuestion'
                  noul: '#/components/schemas/GroundedNoulQuestion'
                  score: '#/components/schemas/GroundedScoreQuestion'
          minProperties: 1
        include_excerpts:
          type: boolean
          title: Include Excerpts
          description: >-
            When false, every citation has an empty excerpts array. Use for
            token efficiency if LLM consuming downstream results.
          default: true
      type: object
      required:
        - state
        - questions
      title: Decision request
      additionalProperties: false
    GroundedDecisionResponse:
      properties:
        mode:
          type: string
          const: fast
          title: Mode
        answers:
          additionalProperties:
            oneOf:
              - $ref: '#/components/schemas/GroundedChoiceAnswer'
              - $ref: '#/components/schemas/GroundedScoreAnswer'
              - $ref: '#/components/schemas/GroundedNoulAnswer'
              - $ref: '#/components/schemas/GroundedRefusalAnswer'
            discriminator:
              propertyName: type
              mapping:
                choice: '#/components/schemas/GroundedChoiceAnswer'
                noul: '#/components/schemas/GroundedNoulAnswer'
                refusal: '#/components/schemas/GroundedRefusalAnswer'
                score: '#/components/schemas/GroundedScoreAnswer'
          type: object
          title: Answers
          description: >-
            Answers keyed by the question names from the request. Any question
            can return a refusal.
        usage:
          $ref: '#/components/schemas/GroundedDecisionUsage'
        citations:
          items:
            $ref: '#/components/schemas/GroundedDecisionCitation'
          type: array
          title: Citations
          description: >-
            Web sources included in the shared decision context. Applies to the
            whole request, without a per-answer source mapping. Can be empty.
        decision_id:
          description: >-
            Decision identifier: `decisions_` followed by a UUID without
            hyphens.
          examples:
            - decisions_cad0a6d2dec046bd95ae900527d880e7
          title: Decision Id
          type: string
      type: object
      required:
        - mode
        - answers
        - usage
        - citations
        - decision_id
      title: Decision response
    ErrorResponse:
      properties:
        type:
          type: string
          const: error
          title: Type
          description: Always 'error'.
        error:
          $ref: '#/components/schemas/Error'
          description: Error.
      type: object
      required:
        - type
        - error
      title: ErrorResponse
      description: Response object used for non-200 status codes.
    JsonValue: {}
    GroundedChoiceAnswer:
      properties:
        type:
          type: string
          const: choice
          title: Type
          default: choice
        choice:
          type: string
          title: Choice
          description: Selected option name from the question criteria.
        probabilities:
          additionalProperties:
            type: number
          type: object
          title: Probabilities
          description: Estimated probability for each option, keyed by option name.
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
          description: Model-reported confidence, when available.
      type: object
      required:
        - choice
        - probabilities
      title: Choice
    GroundedScoreAnswer:
      properties:
        type:
          type: string
          const: score
          title: Type
          default: score
        score:
          type: number
          title: Score
          description: >-
            Probability-weighted mean of the zero-based level indices. Can be
            fractional.
        legend:
          additionalProperties:
            type: string
          type: object
          title: Legend
          description: >-
            Maps string indices to the level descriptions from the question
            criteria.
        probabilities:
          additionalProperties:
            type: number
          type: object
          title: Probabilities
          description: Estimated probability for each level, keyed by its string index.
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
          description: Model-reported confidence, when available.
      type: object
      required:
        - score
        - legend
        - probabilities
      title: Score
    GroundedNoulAnswer:
      properties:
        type:
          type: string
          const: noul
          title: Type
          default: noul
        noul:
          type: number
          title: Noul
          description: Estimated probability that the condition is true, from 0 to 1.
      type: object
      required:
        - noul
      title: Predicate
    GroundedRefusalAnswer:
      properties:
        type:
          type: string
          const: refusal
          title: Type
          default: refusal
          description: >-
            The downstream decision provider refused this question; no value or
            probabilities are returned.
      type: object
      title: Refusal
    GroundedDecisionUsage:
      properties:
        input_tokens:
          title: Input Tokens
          type: integer
        output_tokens:
          type: integer
          title: Output Tokens
          description: Always 0 for compatibility with the upstream contract.
          const: 0
      type: object
      required:
        - input_tokens
        - output_tokens
      title: Usage
    GroundedDecisionCitation:
      properties:
        url:
          type: string
          title: Url
          description: Source page URL.
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Page title. Omitted when unavailable.
        excerpts:
          items:
            type: string
          type: array
          title: Excerpts
          description: >-
            Passages used to ground the decision. Empty when include_excerpts is
            false.
      type: object
      required:
        - url
        - excerpts
      title: Citation
    Error:
      properties:
        ref_id:
          type: string
          title: Reference ID
          description: Reference ID for the error.
        message:
          type: string
          title: Message
          description: Human-readable message.
        detail:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Detail
          description: Optional detail supporting the error.
      type: object
      required:
        - ref_id
        - message
      title: Error
      description: An error message.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````