# SDK & REST

Source: https://docs.rushdb.com/2.x/connect/sdks/

Use the TypeScript SDK, Python SDK, or REST API when RushDB is part of your application, service, script, or data pipeline.

The fastest useful test is a nested import followed by a search. Nested objects become linked records automatically.

## Install, Connect, and Write

**TypeScript**

```bash
npm install @rushdb/javascript-sdk
```

```typescript

const db = new RushDB('RUSHDB_API_KEY')

await db.records.importJson({
  label: 'PROJECT',
  data: {
    name: 'RushDB adoption',
    TASK: [
      { title: 'Connect RushDB', status: 'done' },
      { title: 'Query linked records', status: 'pending' }
    ]
  }
})
```

**Python**

```bash
pip install rushdb
```

```python
from rushdb import RushDB

db = RushDB("RUSHDB_API_KEY")

db.records.create_many(
    label="PROJECT",
    data={
        "name": "RushDB adoption",
        "TASK": [
            {"title": "Connect RushDB", "status": "done"},
            {"title": "Query linked records", "status": "pending"},
        ],
    },
)
```

**REST**

```bash
export RUSHDB_API_KEY=your-api-key

curl -X POST https://api.rushdb.com/api/v1/records/import/json \
  -H "Authorization: Bearer $RUSHDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "PROJECT",
    "data": {
      "name": "RushDB adoption",
      "TASK": [
        {"title": "Connect RushDB", "status": "done"},
        {"title": "Query linked records", "status": "pending"}
      ]
    }
  }'
```

## Verify with a Read

**TypeScript**

```typescript
const { data: projects, total } = await db.records.find({
  labels: ['PROJECT'],
  where: { name: 'RushDB adoption' }
})

console.log({ total, projects })
```

**Python**

```python
projects = db.records.find({
    "labels": ["PROJECT"],
    "where": {"name": "RushDB adoption"},
})

print(projects.total, projects.data)
```

**REST**

```bash
curl -X POST https://api.rushdb.com/api/v1/records/search \
  -H "Authorization: Bearer $RUSHDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "labels": ["PROJECT"],
    "where": {"name": "RushDB adoption"}
  }'
```

## Self-Hosted Instance

**TypeScript**

```typescript
const db = new RushDB('RUSHDB_API_KEY', {
  url: 'https://your-rushdb.example.com/api/v1'
})
```

**Python**

```python
db = RushDB("RUSHDB_API_KEY", url="https://your-rushdb.example.com")
```

**REST**

```bash
export RUSHDB_URL=https://your-rushdb.example.com

curl -X POST "$RUSHDB_URL/api/v1/records/search" \
  -H "Authorization: Bearer $RUSHDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"labels": ["PROJECT"]}'
```

## Add Semantic Search

Semantic search requires a one-time embedding index for the label and text property you want to search. After the first write/read flow works:

1. [Create an embedding index](/learn/semantic-search/manage-indexes).
2. Wait until the index status is `ready`.
3. [Run semantic search](/learn/semantic-search).

For natural-language query planning over your schema, see [Smart Search](/learn/search-query/smart-search).

## Full References

- [TypeScript / JavaScript reference](/learn/reference/typescript)
- [Python reference](/learn/reference/python)
- [REST API reference](/learn/reference/rest-api/introduction)
- [Store records](/learn/records-and-queries/store-records)
- [Import nested data](/learn/records-and-queries/import-data)
