Skip to content
Back to skills

330 Api 31c26952

ASecurity

```typescript interface VectorizeVector { id: string // Max 64 bytes values: number[] // Must match index dimensions namespace?: string // Optional partition (max 64 bytes) metadata?: Record<string, any> // Max 10 KiB } ```

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmenttypescriptgoapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 330-api_31c26952 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 330 Api 31c26952?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 330 Api 31c26952
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-330-api-31c26952/badge)](https://www.skillsdirectory.com/skills/tools-only-330-api-31c26952)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Vectorize API Reference

## Types

```typescript
interface VectorizeVector {
  id: string // Max 64 bytes
  values: number[] // Must match index dimensions
  namespace?: string // Optional partition (max 64 bytes)
  metadata?: Record<string, any> // Max 10 KiB
}
```

## Query

```typescript
const matches = await env.VECTORIZE.query(queryVector, {
  topK: 10, // Max 100 (or 20 with returnValues/returnMetadata:"all")
  returnMetadata: 'indexed', // "none" | "indexed" | "all"
  returnValues: false,
  namespace: 'tenant-123',
  filter: { category: 'docs' },
})
// matches.matches[0] = { id, score, metadata? }
```

**returnMetadata:** `"none"` (fastest) → `"indexed"` (recommended) → `"all"` (topK max 20)

**queryById (V2 only):** Search using existing vector as query.

```typescript
await env.VECTORIZE.queryById('doc-123', { topK: 5 })
```

## Insert/Upsert

```typescript
// Insert: ignores duplicates (keeps first)
await env.VECTORIZE.insert([{ id, values, metadata }])

// Upsert: overwrites duplicates (keeps last)
await env.VECTORIZE.upsert([{ id, values, metadata }])
```

**Max 500 vectors per call.** Queryable after 5-10 seconds.

## Other Operations

```typescript
// Get by IDs
const vectors = await env.VECTORIZE.getByIds(['id1', 'id2'])

// Delete (max 1000 IDs per call)
await env.VECTORIZE.deleteByIds(['id1', 'id2'])

// Index info
const info = await env.VECTORIZE.describe()
// { dimensions, metric, vectorCount }
```

## Filtering

Requires metadata index. Filter operators:

| Operator                     | Example                          |
| ---------------------------- | -------------------------------- |
| `$eq` (implicit)             | `{ category: "docs" }`           |
| `$ne`                        | `{ status: { $ne: "deleted" } }` |
| `$in` / `$nin`               | `{ tag: { $in: ["sale"] } }`     |
| `$lt`, `$lte`, `$gt`, `$gte` | `{ price: { $lt: 100 } }`        |

**Constraints:** Max 2048 bytes, no dots/`$` in keys, values: string/number/boolean/null.

## Performance

| Configuration               | topK Limit | Speed   |
| --------------------------- | ---------- | ------- |
| No metadata                 | 100        | Fastest |
| `returnMetadata: "indexed"` | 100        | Fast    |
| `returnMetadata: "all"`     | 20         | Slower  |
| `returnValues: true`        | 20         | Slower  |

**Batch operations:** Always batch (500/call) for optimal throughput.

```typescript
for (let i = 0; i < vectors.length; i += 500) {
  await env.VECTORIZE.upsert(vectors.slice(i, i + 500))
}
```

Files in this skill

  • README.md1.1 KB
  • skill.md2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.