> For the complete documentation index, see [llms.txt](https://bittu-1.gitbook.io/meshkit-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bittu-1.gitbook.io/meshkit-documentation/api-reference.md).

# API Reference

This section documents the public MeshKit TypeScript API.

## Navigation

| API                                                              | Purpose                               |
| ---------------------------------------------------------------- | ------------------------------------- |
| [init()](/meshkit-documentation/api/init.md)                     | Create a MeshKit client instance.     |
| [testConnection()](/meshkit-documentation/api/testconnection.md) | Validate provider authentication.     |
| [store()](/meshkit-documentation/api/store.md)                   | Store JSON-compatible data on IPFS.   |
| [retrieve()](/meshkit-documentation/api/retrieve.md)             | Retrieve JSON-compatible data by CID. |
| [upload()](/meshkit-documentation/api/upload.md)                 | Upload a `Blob` or `File`.            |
| [download()](/meshkit-documentation/api/download.md)             | Download a file as a `Blob`.          |
| [send()](/meshkit-documentation/api/send.md)                     | Store a simple recipient message.     |
| [receive()](/meshkit-documentation/api/receive.md)               | Retrieve a stored recipient message.  |
| [revoke()](/meshkit-documentation/api/revoke.md)                 | Unpin a CID from Pinata.              |

## Shared Models

### MeshkitConfig

```ts
interface MeshkitConfig {
  provider: "pinata" | "filebase" | "storacha";
  providerToken: string;
  gatewayUrl?: string;
  keyService?: KeyService;
}
```

`providerToken` is currently used as the Pinata JWT. `gatewayUrl` is optional and defaults to the Pinata public gateway. `keyService` is defined but not used by the current implementation.

### MeshkitRecord

```ts
interface MeshkitRecord<T = any> {
  cid: string;
  timestamp: number;
  data?: T;
  size: number;
}
```

Write operations return a record containing the CID, a Unix timestamp in milliseconds, optional data, and a size value.

### MeshkitMessage

```ts
interface MeshkitMessage {
  recipientId: string;
  payload: string;
  timestamp: number;
}
```

`send()` stores this object and `receive()` retrieves it.

### StoreOptions

```ts
interface StoreOptions {
  encrypt?: boolean;
  label?: string;
}
```

These options are accepted by the method signature but are not currently applied by the implementation.

### RetrieveOptions

```ts
interface RetrieveOptions {
  decrypt?: boolean;
}
```

This option is accepted by the method signature but is not currently applied by the implementation.

## Current Provider

Pinata is the only implemented provider. The `provider` union type includes `"filebase"` and `"storacha"`, but `Meshkit.init()` currently constructs `PinataProvider`.

Planned, not yet implemented:

* Filebase provider support
* Storacha provider support

## Related Guides

* [Getting Started](/meshkit-documentation/getting-started.md)
* [Authentication](/meshkit-documentation/authentication.md)
* [Architecture Overview](/meshkit-documentation/architecture.md)
* [Error Handling](/meshkit-documentation/error-handling.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bittu-1.gitbook.io/meshkit-documentation/api-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
