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

# Python SDK — Reference

> Every method and parameter in the memic Python SDK.

<Info>
  This reference page is a placeholder for v1. A future release will
  auto-generate it from the `memic` package docstrings on every SDK release.
  For now, refer to the [API Reference](/api-reference/introduction) for
  endpoint-level details.
</Info>

## Client

### `Memic`

```python theme={null}
Memic(
    api_key: str = None,
    base_url: str = "https://api.memic.ai/api/v1",
    timeout: float = 30.0,
    max_retries: int = 3,
)
```

The main SDK client. If `api_key` is not provided, it reads from the
`MEMIC_API_KEY` environment variable.

## Context

### `client.me()`

Return the organization, project, and environment resolved from the API key.

Maps to: `GET /me`

## Projects

### `client.projects.list()`

Return all projects in the organization.

Maps to: `GET /projects`

## Files

### `client.files.upload(path: str)`

Upload a file from the local filesystem. Handles init + PUT + confirm
internally.

Maps to: `POST /files/init` + presigned `PUT` + `POST /files/{id}/confirm`

### `client.files.list(page=1, page_size=50)`

List files in the current environment.

Maps to: `GET /files`

### `client.files.iter_all()`

Iterator that yields every file, handling pagination transparently.

### `client.files.get_status(file_id: str)`

Return the processing status of a file.

Maps to: `GET /files/{file_id}/status`

### `client.files.delete(file_id: str)`

Delete a file and all associated vectors/chunks.

Maps to: `DELETE /files/{file_id}`

## Search

### `client.search(query: str, top_k: int = 5, filters: dict = None)`

Run semantic search against the environment.

Maps to: `POST /search`

## Chat

### `client.chat(query_or_messages, ...)`

Chat with documents in the environment. Accepts either a single query
string or a full `messages` array for multi-turn conversations.

Maps to: `POST /chat`

## Prompts

### `client.prompts.get(name: str)`

Return the live version of a managed prompt. The returned object has a
`.render(**kwargs)` method for variable substitution.

Maps to: `GET /prompts/{name}`

## Exceptions

| Exception             | When raised                            |
| --------------------- | -------------------------------------- |
| `AuthenticationError` | 401 from the API                       |
| `ForbiddenError`      | 403                                    |
| `NotFoundError`       | 404                                    |
| `RateLimitError`      | 429 (includes `retry_after` attribute) |
| `ServerError`         | 5xx                                    |
| `NetworkError`        | Connection/timeout issues              |

## Related

<Card title="API Reference" icon="code" href="/api-reference/introduction" horizontal>
  Full REST API reference with try-it playground.
</Card>
