Skip to content

Latest commit

 

History

History
129 lines (102 loc) · 4.76 KB

quickstart.mdx

File metadata and controls

129 lines (102 loc) · 4.76 KB
title DeckFlow quickstart
sidebarTitle Quickstart
description Create an API key, list your spaces, and search your documents by meaning.

In this quickstart you authenticate with an API key, find the space that holds your files, and run a semantic search against it. You need a DeckFlow account with at least one uploaded file. Semantic search starts at the Pro plan. On Free and Basic, follow the same steps with exact search.

The base URL in these examples is `{{apiBaseUrl}}`. Replace it with your DeckFlow API address.

Start with your agent

Paste this prompt into Claude Code, Codex, or Cursor to have your agent run the same steps.

<Prompt description="Run the DeckFlow quickstart with a coding agent" actions={["copy", "cursor"]}> Read the DeckFlow quickstart and authentication pages from this documentation site (append .md to a page URL for Markdown). Then ask me for a read-only API key, export it as DECKFLOW_API_KEY, list my spaces, and run one semantic search in the space I choose. Report the file name and location of each hit.

Your first search

Sign in to DeckFlow and create a key on the API keys page of your account. Keys are read-only by default, which is enough to search and read.
Copy the secret when it appears. DeckFlow shows it once and stores only a digest.

```bash
export DECKFLOW_API_KEY="dbk_..."
export DECKFLOW_API_URL="{{apiBaseUrl}}"
```

See [Authentication](/authentication) for scopes, expiry, and revocation.
A space is the top-level container for folders and files. Every other call takes a space ID.
<CodeGroup>
```bash cURL
curl --fail-with-body "$DECKFLOW_API_URL/my/spaces" \
  -H "Authorization: Bearer $DECKFLOW_API_KEY"
```

```ts TypeScript
import { createClient } from "@deckflow/deckbase-sdk";

const client = createClient(
  process.env.DECKFLOW_API_URL!,
  process.env.DECKFLOW_API_KEY!,
);

const spaces = await client.call("my.spaces", {});
console.log(spaces);
```
</CodeGroup>

Copy the ID of the space you want to search into `SPACE_ID`.
Send a question to the semantic search endpoint. The query does not have to share words, or even a language, with the document.
<CodeGroup>
```bash cURL
curl --fail-with-body "$DECKFLOW_API_URL/spaces/$SPACE_ID/search/query" \
  -H "Authorization: Bearer $DECKFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "Which market grew fastest last year?", "limit": 5}'
```

```ts TypeScript
const result = await client.call("search.query", {
  spaceId: process.env.SPACE_ID!,
  query: "Which market grew fastest last year?",
  limit: 5,
});

console.log(result.hits);
```
</CodeGroup>

Each hit names the file, the location inside it, and the passage that matched.

{/* TODO: add a trimmed response example (hits, location, evidence) taken from a real call. */}
Remember the exact wording, a number, or an ID? Use [exact search](/search/find) instead. It matches literal text or a regular expression and is available on every plan.

Next steps

How spaces, folders, files, and revisions fit together. Send bytes to storage and attach them to a file. Choose between exact search, semantic search, and answers. Install the typed TypeScript client.

Troubleshooting

The key is missing, mistyped, expired, or revoked. Send it as `Authorization: Bearer dbk_...`. Read-only keys cannot create, change, or delete anything. Create a key with the write scope for those calls. Search is not turned on for this deployment. The resource does not exist, your account cannot see it, or your role does not allow the action. DeckFlow returns the same status for all three. Files are indexed after upload, and each index layer depends on your plan and on the switches of the space. A layer that is off returns no hits instead of an error. See [Indexing](/search/indexing).