# createInscription

{% hint style="info" %}
This is an [Xverse custom method](/sats-connect/wallet-methods/xverse-custom-methods.md). It can only be invoked for users using the [Xverse wallet](https://www.xverse.app/).
{% endhint %}

```typescript
import { createInscription } from 'sats-connect'
```

You can request the creation of an inscription via the user's wallet. The inscription transaction will originate from the user's wallet address and the inscribed sats will appear directly in the user's ordinals address. You can create both text and file inscriptions.

You can optionally charge a fee to the user for your service by specifying a fee amount and receiving address using the `appFee` and `appFeeAddress` parameters. The fee will be included as an additional output in the inscription transaction.

Once approved by the user, the inscription transactions are immediately broadcast. The function will return a transaction ID which you can track.

<table><thead><tr><th width="313">Payload</th><th>Description</th></tr></thead><tbody><tr><td>network</td><td>The Network type you want to use. Please note that inscriptions currently only support Mainnet.</td></tr><tr><td>contentType</td><td>The content/mime type of the content being inscribed. It is up to you to extract and send through the correct content type for the content.</td></tr><tr><td>payloadType</td><td>The format of the content being sent through. (one of "PLAIN_TEXT" or "BASE_64")</td></tr><tr><td>content</td><td>The content being inscribed. If the `payloadType` has been set to "PLAIN_TEXT", this content will be inscribed directly; if set to "BASE_64", the content will be converted into a binary buffer before being inscribed (use this for image and other binary files).</td></tr><tr><td>appFee (optional)</td><td>If you would like to charge a fee for your services, add the sats value here.</td></tr><tr><td>appFeeAddress (optional)</td><td>This is the address where your appFee will be sent.</td></tr><tr><td>suggestedMinerFeeRate (optional)</td><td> This will be the initial fee rate set for the transaction in the confirmation dialog. The user will be able to change it within the wallet if they desire.</td></tr></tbody></table>

## Examples

#### Creating a text/html inscription

```javascript
import { createInscription } from 'sats-connect'

const contentType = "text/html"; 
const content = "My inscription text";
const payloadType = "PLAIN_TEXT";

// optional parameters:
const appFeeAddress = "2NEYt8s1QPVmTmFTefMLidtmy66ZoqfSz7n", // the address where the inscription fee should go
const appFee = 1500, // the amount of sats that should be sent to the fee address
const suggestedMinerFeeRate = 10; // suggest a fee rate for the transaction in sats/byte

await createInscription({
  payload: {
    network: {
      type: network,
    },
    contentType,
    content,
    payloadType,
    appFeeAddress,
    appFee,
    suggestedMinerFeeRate,
  },
  onFinish: (response) => {
    alert(response.txId);
  },
  onCancel: () => alert("Canceled"),
});
```

#### Creating a file or image inscription

```javascript
const content = ""; // Your base64 encoded file/image content
const contentType = "image/jpeg";
const payloadType = "BASE_64";

await createInscription({
  payload: {
    network: {
      type: network,
    },
    contentType,
    content,
    payloadType,
  },
  onFinish: (response) => {
    alert(response.txId);
  },
  onCancel: () => alert("Canceled"),
});
```


---

# 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.xverse.app/sats-connect/bitcoin-methods/createinscription.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.
