# Assets

### Upload new Assets

As a user, you can upload assets to your domain. When uploading an asset, you can specify the document path where the asset will be stored.

```typescript
const ctxDocumentPath = "document/path";
const localFilePath = "file/path.jpg";
const asset = await ctx.createAsset(ctxDocumentPath, localFilePath, metadata /* optional */);
```

### Update an Asset

You can update an existing asset by providing the document path and the local file path of the updated asset. It returns a document with a new version.

```typescript
const localFilePath = "file/path.jpg";
const asset = await ctxDocument.data.updateAsset(localFilePath, metadata /* optional */);
```


---

# Agent Instructions: 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:

```
GET https://docs.ctx.xyz/developers/typescript-sdk/assets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
