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

> Automate telemetry review and data export using Sift's REST and gRPC APIs

# API

export const MintTable = ({columns = [], rows = [], columnWidths = []}) => {
  const pushTextWithLineBreaks = (parts, text, keyBase) => {
    const segments = String(text).split(/\\n|\n/);
    segments.forEach((segment, idx) => {
      if (segment) {
        parts.push(<span key={`${keyBase}-text-${idx}`}>{segment}</span>);
      }
      if (idx < segments.length - 1) {
        parts.push(<br key={`${keyBase}-br-${idx}`} />);
      }
    });
  };
  const parseMarkdown = text => {
    if (text === null || text === undefined) return "";
    const str = String(text);
    const parts = [];
    let lastIndex = 0;
    const pattern = /(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*|\[([^\]]+)\]\(([^)]+)\))/g;
    let match;
    while (true) {
      match = pattern.exec(str);
      if (match === null) {
        break;
      }
      if (match.index > lastIndex) {
        pushTextWithLineBreaks(parts, str.substring(lastIndex, match.index), `before-${lastIndex}`);
      }
      const fullMatch = match[0];
      if (fullMatch.startsWith("`") && fullMatch.endsWith("`")) {
        parts.push(<code key={match.index}>{fullMatch.slice(1, -1)}</code>);
      } else if (fullMatch.startsWith("**") && fullMatch.endsWith("**")) {
        parts.push(<strong key={match.index}>{fullMatch.slice(2, -2)}</strong>);
      } else if (fullMatch.startsWith("*") && fullMatch.endsWith("*")) {
        parts.push(<em key={match.index}>{fullMatch.slice(1, -1)}</em>);
      } else if (fullMatch.startsWith("[")) {
        const linkText = match[2];
        const linkUrl = match[3];
        parts.push(<a key={match.index} href={linkUrl} className="text-black-600 dark:text-black-400">
            {linkText}
          </a>);
      }
      lastIndex = pattern.lastIndex;
    }
    if (lastIndex < str.length) {
      pushTextWithLineBreaks(parts, str.substring(lastIndex), `tail-${lastIndex}`);
    }
    if (parts.length > 0) {
      return parts;
    }
    const plainParts = [];
    pushTextWithLineBreaks(plainParts, str, "plain");
    return plainParts.length ? plainParts : str;
  };
  const safeColumns = Array.isArray(columns) ? columns : [];
  const safeRows = Array.isArray(rows) ? rows : [];
  const safeColumnWidths = Array.isArray(columnWidths) ? columnWidths : [];
  const hasColumnWidths = safeColumnWidths.some(w => w !== null && w !== undefined && w !== "");
  const toCssWidth = width => typeof width === "number" ? `${width}px` : String(width);
  const getColumnStyle = idx => {
    const rawWidth = safeColumnWidths[idx];
    if (rawWidth === null || rawWidth === undefined || rawWidth === "") {
      return undefined;
    }
    const width = toCssWidth(rawWidth);
    return {
      width,
      minWidth: width
    };
  };
  const containerStyle = hasColumnWidths ? undefined : {
    overflowX: "auto"
  };
  const tableStyle = hasColumnWidths ? {
    tableLayout: "fixed",
    width: "100%"
  } : {
    width: "max-content",
    minWidth: "100%"
  };
  if (!Array.isArray(columns) || !Array.isArray(rows) || !Array.isArray(columnWidths)) {
    console.warn("MintTable received invalid props:", {
      columns,
      rows,
      columnWidths
    });
  }
  if (!safeColumns.length && !safeRows.length) {
    return null;
  }
  return <div className="mint-table-container" style={containerStyle}>
      <table style={tableStyle}>
        {hasColumnWidths && <colgroup>
            {safeColumns.map((_, idx) => {
    const style = getColumnStyle(idx);
    return <col key={idx} style={style} />;
  })}
          </colgroup>}
        <thead>
          <tr>
            {safeColumns.map((col, idx) => <th key={idx} className="text-left" style={getColumnStyle(idx)}>
                <b>{parseMarkdown(col)}</b>
              </th>)}
          </tr>
        </thead>
        <tbody>
          {safeRows.map((row, rIdx) => {
    const safeRow = Array.isArray(row) ? row : [];
    return <tr key={rIdx}>
                {safeRow.map((cell, cIdx) => <td key={cIdx} style={getColumnStyle(cIdx)}>
                    {parseMarkdown(cell)}
                  </td>)}
              </tr>;
  })}
        </tbody>
      </table>
    </div>;
};

<span id="is-home-page" style={{display: 'none'}} />

<Steps>
  <Step title="Authenticate" icon="shield-keyhole" titleSize="h4">
    Every request needs an API key and a base URL, both obtained in the Sift UI, to authenticate REST or gRPC requests.

    <CardGroup cols={2}>
      <Card title="Set up API access" href="/documentation/manage/set-up-api-access" horizontal>
        Create an API key and find your REST and gRPC base URLs.
      </Card>

      <Card title="Authenticate with the API" href="/api/authenticate/authenticate-with-the-api" horizontal>
        Send an authenticated request to the REST or gRPC API.
      </Card>
    </CardGroup>
  </Step>

  <Step title="Automate telemetry review" icon="magnifying-glass" titleSize="h4">
    Evaluate Rules programmatically to generate Reports and Annotations, including Rules created and evaluated entirely through the API.

    <CardGroup cols={2}>
      <Card title="Evaluate Rules" href="/api/review/rules/evaluate-rules" horizontal>
        Evaluate Rules against a Run or Asset and generate a Report.
      </Card>

      <Card title="Manage Ad Hoc Rules" href="/api/review/ad-hoc-rules/manage-ad-hoc-rules" horizontal>
        Create, preview, and evaluate Ad Hoc Rules for CI/CD and automated workflows.
      </Card>
    </CardGroup>
  </Step>

  <Step title="Export and integrate" icon="file-export" titleSize="h4">
    Pull Channel data out of Sift for use in external tools, custom pipelines, and analysis environments.

    <CardGroup cols={2}>
      <Card title="Export data programmatically" href="/api/export/export-data-programmatically" horizontal>
        Query Channel data or export it to file using the REST API or official client libraries.
      </Card>

      <Card title="Export data to MATLAB" href="/api/export/export-data-to-matlab" horizontal>
        Get telemetry from Sift into MATLAB using the Python client or the REST API.
      </Card>
    </CardGroup>
  </Step>
</Steps>

## Choosing between REST and gRPC

Sift exposes two APIs, REST and [gRPC](/api/reference/protocol-buffers/index), both generated from the same underlying Protocol Buffers definitions to ensure consistency.

<MintTable
  columns={['API type', 'Best for', 'How to connect']}
  columnWidths={['15%', '35%', '50%']}
  rows={[
['REST', 'Rapid prototyping, low to moderate traffic volumes', 'Standard HTTP tools such as Postman or curl.'],
['gRPC', 'High-frequency telemetry ingestion, real-time analysis', '[gRPCurl](https://github.com/fullstorydev/grpcurl), your own client, or official [Python](https://pypi.org/project/sift-stack-py/), [Rust](https://crates.io/crates/sift_rs), and [Go](https://pkg.go.dev/github.com/sift-stack/sift/go) client libraries. \n\nOther languages or protobuf versions: [use Buf](/api/clients/generate-a-client-with-buf).']
]}
/>

<Info>
  **No code required:** For command-line imports and exports, use the [Sift CLI](/documentation/cli/sift-cli) instead of calling the API directly.
</Info>
