LeanData Graph API

Retrieve routing-graph metadata and trigger LeanData One Time Routing from external systems to power custom orchestration experiences. The Graph API exposes `orchestration/v1/routing-graphs` for graph discovery (trigger nodes, edges, names) and `orchestration/v1/one-time-routing` plus `orchestration/v1/one-time-routing/{jobId}` for invoking and monitoring one-time routing jobs against a Salesforce org. Hosted at `https://api.leandata.com/orchestration/v1`.

LeanData Graph API is one of 4 APIs that LeanData publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

This API exposes 1 machine-runnable capability that can be deployed as REST, MCP, or Agent Skill surfaces via Naftiko.

Tagged areas include Orchestration, Routing, Graph, and One Time Routing. The published artifact set on APIs.io includes API documentation, an OpenAPI specification, and 1 Naftiko capability spec.

OpenAPI Specification

leandata-graph-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: LeanData Graph API
  description: >-
    Run LeanData One Time Routing and fetch routing graph metadata to power
    custom orchestration solutions and integrations.
  version: 1.0.0
servers:
  - url: https://api.leandata.com
tags:
  - name: Retrieve Routing Graphs Information
    description: >
      <p>This section outlines the endpoints used to retrieve Routing Graphs
      information for building a custom orchestration experience. The endpoint
      returns information such as trigger node names, the edges in those trigger
      nodes, graph name, etc</p>

      <ul>

      <li><code>orchestration/v1/routing-graphs</code> — Use this endpoint
      <strong>when fetching routing graphs</strong> from a particular SFDC
      org.</li>

      </ul>
  - name: One Time Routing
    description: >
      <p>This section describes the endpoints used to trigger 1x Routing for
      creating a custom orchestration experience, as well as to retrieve the
      status of the resulting job. When invoked, the 1x Routing endpoint returns
      basic job metadata—including the <code>jobId</code>—which can be used to
      check the job’s status.</p>

      <ul>

      <li><p><code>orchestration/v1/one-time-routing</code> — Use this endpoint
      to invoke 1x routing for a particular SFDC org</p>

      </li>

      <li><p><code>orchestration/v1/one-time-routing/:jobId</code> — Use this
      endpoint to retrieve the job status of a 1x routing for a particular SFDC
      org</p>

      </li>

      </ul>

      <p>❗️ <strong>Important:</strong> The API does <strong>not</strong>
      validate FlowBuilder graphs before triggering routing. If you invoke 1x
      Routing to an invalid or misconfigured graph, the request will still be
      processed—but routing will fail silently. No error response will be
      returned from the API.<br />✅ To avoid unexpected behavior, please ensure
      the graph is valid and functioning as expected within the LeanData
      application before using it in API-triggered routing.</p>
paths:
  /orchestration/v1/routing-graphs:
    get:
      tags:
        - Retrieve Routing Graphs Information
      summary: orchestration/v1/routing-graphs
      description: >
        <p>This endpoint retrieves a collection of configured routing graphs,
        allowing you to filter them by object type, deployment status, and name.
        This is useful for programmatically inspecting or listing the routing
        flows defined within your system.</p>

        <p><strong>Endpoint:</strong> <code>GET
        /orchestration/v1/routing-graphs</code></p>

        <h4 id="request-body-parameters">Request Body Parameters</h4>

        <ul>

        <li><p><code>objectType</code> (required) — A string value that
        specifies the type of object the routing graphs are associated with
        (e.g., "lead", "contact", "account").</p>

        </li>

        <li><p><code>isLive</code> (optional) — A boolean value that filters
        graphs by their deployment status. Set to <code>true</code> to retrieve
        only live (deployed) graphs, or <code>false</code> for non-live graphs.
        If omitted, all graphs (regardless of deployment status) are returned.
        Note: For Business Unit deployments, this will include both <code>Ready
        To Go Live</code> and <code>Live</code> deployments.</p>

        </li>

        <li><p><code>name</code> (optional) — A string value that filters graphs
        where the graph's name contains this substring (case-insensitive).</p>

        </li>

        <li><p><code>routingQueryLimit</code> (optional) -- A numeric value that
        controls the batch size for fetching routing graphs from the API key's
        associated Salesforce organization. All matching graphs will still be
        returned, but a higher value will result in larger batches and
        potentially faster overall retrieval, up to the Salesforce API limits.
        The default value is 20.</p>

        </li>

        </ul>

        <h4 id="response-body-parameters">Response Body Parameters</h4>

        <p>The response will contain a <strong><code>graphs</code></strong>
        array, which is a collection of <strong>Graph Objects</strong>. Each
        <strong>Graph Object</strong> provides detailed information about a
        specific routing graph:</p>

        <ul>

        <li><p><strong><code>id</code></strong> (String) — Unique identifier for
        the graph.</p>

        </li>

        <li><p><strong><code>name</code></strong> (String) — Display name of the
        graph.</p>

        </li>

        <li><p><strong><code>isLive</code></strong> (Boolean) — Indicates if the
        graph is currently active in production.</p>

        </li>

        <li><p><strong><code>date</code></strong> (String) — Creation date in
        ISO8601 format.</p>

        </li>

        <li><p><strong><code>time</code></strong> (String) — Creation time in
        ISO8601 format.</p>

        </li>

        <li><p><strong><code>businessUnit</code></strong> (String | null) — Name
        of the associated business unit, <code>null</code> if none.</p>

        </li>

        <li><p><strong><code>businessUnitId</code></strong> (String | null) —
        Identifier for the associated business unit, <code>null</code> if
        none.</p>

        </li>

        <li><p><strong><code>isBUDeleted</code></strong> (Boolean) — Indicates
        if the associated business unit has been deleted.</p>

        </li>

        <li><p><strong><code>editedBy</code></strong> (String) — Identifier of
        the user who last edited the graph.</p>

        </li>

        <li><p><strong><code>editedByName</code></strong> (String) — Display
        name of the user who last edited the graph.</p>

        </li>

        <li><p><strong><code>isGraphAvailableForEdit</code></strong> (Boolean) —
        Indicates if the current user has permission to edit this graph.</p>

        </li>

        <li><p><strong><code>triggerNodeEdges</code></strong> (Object) — This
        object maps trigger node names (keys) to an object containing details
        about their outgoing connections and node type. For each trigger node
        name, the associated object will contain:</p>

        <ul>

        <li><p><strong><code>edges</code></strong> (Array) — An array of
        strings, where each string is the identifier of an outgoing edge or the
        next node in the flow from this trigger node.</p>

        </li>

        <li><p><strong><code>nodeType</code></strong> (String) — The type of the
        node, e.g. <code>TRIGGER</code>, <code>UPDATE TRIGGER</code> etc.</p>

        </li>

        </ul>

        </li>

        <li><p><strong><code>canGraphBeOverridden</code></strong> (Boolean) —
        Indicates if the graph can be overridden by other graphs.</p>

        </li>

        <li><p><strong><code>hasRoutingPriorities</code></strong> (Boolean) —
        Indicates if the graph has routing priority settings. This would
        evaluate to <code>true</code> if an edge on a trigger node has a
        priority setting that is not the default of 5.</p>

        </li>

        <li><p><strong><code>lastModifiedDate</code></strong> (String) — Last
        modification timestamp in ISO8601 format.</p>

        </li>

        <li><p><strong><code>lastModifiedBy</code></strong> (String) —
        Identifier of the user who last modified the graph.</p>

        </li>

        <li><p><strong><code>scheduledJobs</code></strong> (Array | null) — An
        array of scheduled jobs associated with this graph, <code>null</code> if
        none.</p>

        </li>

        <li><p><strong><code>lastDeployedDate</code></strong> (String) —
        Timestamp of the last deployment in ISO8601 format.</p>

        </li>

        </ul>
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /orchestration/v1/one-time-routing:
    post:
      tags:
        - One Time Routing
      summary: orchestration/v1/one-time-routing
      description: >
        <p><strong>Endpoint:</strong> <code>POST
        https://api.leandata.com/orchestration/v1/one-time-routing</code></p>

        <p>❗️ <strong>Important:</strong> The API does <strong>not</strong>
        validate FlowBuilder graphs before triggering routing. If you invoke 1x
        Routing to an invalid or misconfigured graph, the request will still be
        processed—but routing will fail silently. No error response will be
        returned from the API.<br />✅ To avoid unexpected behavior, please
        ensure the graph is valid and functioning as expected within the
        LeanData application before using it in API-triggered routing.</p>

        <h3 id="headers">Headers</h3>

        <ul>

        <li><p><code>x-api-key</code> (required) — Your unique API key for
        authentication.</p>

        </li>

        <li><p><code>Content-Type</code> (required) — Must be
        <code>application/json</code>.</p>

        </li>

        </ul>

        <hr />

        <h4 id="request-body-parameters">Request Body Parameters</h4>

        <ul>

        <li><p><code>objectType</code> (required) — A string value representing
        the type of object to route (e.g., "Lead", "Contact", "Opportunity").
        This must correspond to an object type configured in your LeanData
        instance.</p>

        </li>

        <li><p><code>condition</code> (required) — A string value containing a
        SOQL (Salesforce Object Query Language) WHERE clause to find the
        object(s) to be routed. For example: <code>Id =
        '00Q5f000006KnPbEAK'</code> or <code>Status = 'New Lead'</code>.</p>

        </li>

        <li><p><code>graphName</code> <em>(required if</em> <code>graphId</code>
        <em>is not provided)</em> — A string value that is the exact name of the
        routing graph (configured in the LeanData Flowbuilder) to use for this
        one-time routing operation. If <code>graphId</code> is provided,
        <code>graphName</code> is ignored, even if included in the request.</p>

        </li>

        <li><p><code>graphId</code> <em>(required if</em> <code>graphName</code>
        <em>is not provided)</em> — string value representing the unique ID of
        the routing graph to use for this one-time routing operation. If both
        <code>graphId</code> and <code>graphName</code> are provided,
        <code>graphId</code> is utilized and <code>graphName</code> is
        ignored.</p>

        </li>

        <li><p><code>notificationsDisabled</code> (required) — A boolean value.
        When <code>true</code>, all notifications (e.g., email alerts, Slack
        messages, MSFT messages, etc) that are configured within the specified
        routing graph will be suppressed for this one-time routing execution.
        Set to <code>false</code> to allow notifications.</p>

        </li>

        <li><p><code>nodeType</code> (required) — A string value representing
        the entry point type for the routing graph. Common values include
        'TRIGGER' (for standard trigger-based routing) or 'UPDATE TRIGGER' (for
        routing based on updates to an object).</p>

        </li>

        <li><p><code>edgeName</code> (required) — A string value that is the
        name of the specific edge (transition) from the Trigger Node within the
        specified routing graph that should be followed as the starting point
        for this one-time routing. For example: 'Lead is MQL'.</p>

        </li>

        <li><p><code>allowDedupe</code> (optional) — A boolean value. If
        <code>true</code>, LeanData's deduplication logic will be applied to
        prevent duplicate record processing during routing. Defaults to
        <code>false</code> if not provided.</p>

        </li>

        <li><p><code>businessUnitId</code> (optional) — A string value or
        <code>null</code>. This is the unique identifier of a specific business
        unit graph to route the object(s) through. This is useful for routing
        within a specific organizational segment. <strong>Defaults to</strong>
        <strong><code>null</code></strong> <strong>(no specific business unit
        filter) if not provided.</strong> If Multi-Graph is enabled for
        <code>objectType</code>, <code>businessUnitId</code> is required.</p>

        </li>

        <li><p><code>orderBy</code> (optional) — A string value containing a
        SOQL ORDER BY clause to sort the records found by the
        <code>condition</code>. For example: <code>"CreatedDate DESC"</code> to
        process newer records first.</p>

        </li>

        <li><p><code>queryLimit</code> (optional) — A number value that limits
        the number of records found by the <code>condition</code> that will be
        routed. Useful for testing or processing smaller batches. If omitted,
        all records matching the <code>condition</code> will be considered.</p>

        </li>

        <li><p><code>respectSchedules</code> (optional) — A boolean value. When
        <code>true</code>, records will only be routed to users who are
        currently available according to their configured schedules within
        LeanData. If <code>false</code>, scheduling availability will be
        ignored. Defaults to <code>false</code> if not provided.</p>

        </li>

        <li><p>sendEmail (optional) - A boolean value. When <code>true</code>,
        sends an email to the job owner (in this case, the Routing token user)
        when 1x Routing is completed.</p>

        </li>

        </ul>

        <h4 id="response-body-parameters">Response Body Parameters</h4>

        <p>The response is a JSON string containing a
        <strong><code>result</code></strong> object, which provides details
        about the initiated one-time routing job:</p>

        <ul>

        <li><p><strong><code>condition</code></strong> — A string value that is
        the SOQL condition that was used to select the objects for routing.</p>

        </li>

        <li><p><strong><code>nRecords</code></strong> — A string value
        representing the number of records that were found by the routing
        job.</p>

        </li>

        <li><p><strong><code>jobId</code></strong> — A string value that is the
        unique identifier for the asynchronous one-time routing job. You can use
        this ID to query for the status of the job if such an endpoint is
        available.</p>

        </li>

        <li><p><strong><code>objectType</code></strong> — A string value
        indicating the type of object that was routed.</p>

        </li>

        </ul>
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                objectType: Lead
                condition: Id = '00Q5f000006KnPbEAK'
                graphName: Lead Routing Q2 2025
                notificationsDisabled: false
                nodeType: Trigger
                edgeName: Lead is MQL
                allowDedupe: true
                respectSchedules: true
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}
  /orchestration/v1/one-time-routing/:jobId:
    get:
      tags:
        - One Time Routing
      summary: orchestration/v1/one-time-routing/:jobId
      description: >
        <p><strong>Endpoint:</strong> <code>GET
        https://api.leandata.com/orchestration/v1/one-time-routing/:jobId</code></p>

        <p>This endpoint is used to obtain the status of a One-Time Routing
        job.</p>

        <p>💡 The <code>:jobId</code> path parameter should be replaced with the
        unique ID of the One-Time Routing job you want to read.</p>

        <h4 id="headers">Headers</h4>

        <ul>

        <li><code>x-api-key</code> (required) — Your unique API key for
        authentication.</li>

        </ul>

        <hr />

        <h4 id="request-body-parameters">Request Body Parameters</h4>

        <ul>

        <li><p><code>result</code> — An object that contains metadata about the
        status of the One-Time Routing job.</p>

        <ul>

        <li><p><code>completedAt</code> — Timestamp of the job's completion.</p>

        </li>

        <li><p><code>successCount</code> — A string value representing the
        number of records that were successfully processed by the routing
        job.</p>

        </li>

        <li><p><code>nRecords</code> — A string value representing the number of
        records that were found by the routing job.</p>

        </li>

        <li><p><code>status</code> — A string value representing the status of
        the One-Time Routing job. Because the API does not validate FlowBuilder
        graphs, invalid graphs will be marked as <code>"Complete".</code></p>

        <ul>

        <li><p><code>"Complete"</code></p>

        </li>

        <li><p><code>"Complete with Errors"</code></p>

        </li>

        <li><p><code>"Canceled"</code></p>

        </li>

        <li><p><code>"Failed"</code></p>

        </li>

        <li><p><code>"Processing"</code></p>

        </li>

        </ul>

        </li>

        <li><p><code>jobId</code> — A string value that is the unique identifier
        for the asynchronous One-Time Routing job. You can use this ID to query
        for the status of the job if such an endpoint is available.</p>

        </li>

        </ul>

        </li>

        </ul>
      responses:
        '200':
          description: Successful response
          content:
            application/json: {}