Skip to content

Creating a Writing Moment

This page documents the API endpoint for creating a new Writing Moment on the In Process protocol. No signature is required for this endpoint.

The API uses a unified contract object that supports both creating writing moments on existing collections and creating new collections:

  • Use existing collection: Provide contract.address to add a writing moment to a collection you've already created
  • Create new collection: Provide contract.name and contract.uri to create both a new collection and its first writing moment in a single request

Note: If you want to add writing moments to an existing collection, you must have already created a Collection first. Alternatively, you can create a new collection and its first writing moment together by providing contract.name and contract.uri.

Endpoint

POST https://inprocess.world/api/moment/create/writing

Request Body

The API uses a unified request format with a contract object. The behavior depends on what fields are provided:

  • If contract.address is provided: The writing moment will be added to the existing collection at that address
  • If contract.name and contract.uri are provided (and address is not): A new collection will be created with the specified name and URI, and the writing moment will be added to it
{
  "title": "string",
  "contract": {
    "address": "string", // Optional: Address of existing collection (if provided, uses existing collection)
    "name": "string", // Optional: Collection name (required if address is not provided)
    "uri": "string" // Optional: Collection metadata URI (required if address is not provided)
  },
  "token": {
    "tokenContent": "string", // Writing content for the token (e.g., "Hello world")
    "createReferral": "string", // Referral recipient address
    "salesConfig": {
      "type": "string", // "fixedPrice" | "erc20Mint"
      "pricePerToken": "string", // Price in wei (18 decimals)
      "saleStart": "1717200000", // Unix timestamp as string
      "saleEnd": "18446744073709551615", // Unix timestamp as string
      "currency": "string" // Optional: ERC20 token address (defaults to native token if not provided)
    },
    "mintToCreatorCount": 1, // Number of tokens to mint to creator (usually 1)
    "payoutRecipient": "string" // Optional: Address to receive sale proceeds (defaults to creator if not provided)
  },
  "splits": [
    {
      "address": "string", // Recipient address
      "percentAllocation": 60 // Allocation percentage (0-100)
    },
    {
      "address": "string", // Recipient address
      "percentAllocation": 40 // Allocation percentage (0-100)
    }
  ], // Optional: Splits configuration for revenue sharing (must sum to 100% and have at least 2 recipients)
  "account": "string" // Creator's address
}

Contract Object Behavior

  • Priority: If contract.address is present, it takes priority and the writing moment will be added to that existing collection
  • Fallback: If contract.address is not present, contract.name and contract.uri must be provided to create a new collection

Example Request

Example 1: Create Writing Moment on Existing Collection

cURL
curl -X POST https://inprocess.world/api/moment/create/writing \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Writing Moment",
    "contract": {
      "address": "0xa78f8a4465a3e7e5901f6757ff53b799fb35ffd7"
    },
    "token": {
      "tokenContent": "Hello world",
      "createReferral": "0xReferralAddress",
      "salesConfig": {
        "type": "fixedPrice",
        "pricePerToken": "100000000000000000",
        "saleStart": "1717200000",
        "saleEnd": "18446744073709551615",
        "currency": "0xERC20TokenAddress"
      },
      "mintToCreatorCount": 1,
      "payoutRecipient": "0xPayoutAddress"
    },
    "splits": [
      {
        "address": "0xRecipient1",
        "percentAllocation": 60
      },
      {
        "address": "0xRecipient2",
        "percentAllocation": 40
      }
    ],
    "account": "0xCreatorAddress"
  }'

Example 2: Create New Collection and Writing Moment

cURL
curl -X POST https://inprocess.world/api/moment/create/writing \
  -H "Content-Type: application/json" \
  -d '{
    "contract": {
      "name": "My Collection",
      "uri": "ar://xLM9yGfj8Lo_zUWE1AEjD2gwgySBFQfpgghoQnfGLNE"
    },
    "token": {
      "tokenContent": "Hello world",
      "createReferral": "0xReferralAddress",
      "salesConfig": {
        "type": "fixedPrice",
        "pricePerToken": "100000000000000000",
        "saleStart": "1717200000",
        "saleEnd": "18446744073709551615",
        "currency": "0xERC20TokenAddress"
      },
      "mintToCreatorCount": 1,
      "payoutRecipient": "0xPayoutAddress"
    },
    "splits": [
      {
        "address": "0xRecipient1",
        "percentAllocation": 60
      },
      {
        "address": "0xRecipient2",
        "percentAllocation": 40
      }
    ],
    "account": "0xCreatorAddress"
  }'

Example Response

{
  "contractAddress": "0xContractAddress",
  "tokenId": "1",
  "hash": "0xTransactionHash",
  "chainId": 8453
}

Splits Configuration

You can optionally configure revenue splits to automatically distribute sale proceeds to multiple recipients. When splits are configured, the payoutRecipient in the token configuration will be set to the splits contract address, which will automatically distribute funds according to the specified allocations.

Important requirements for splits:
  • Must have at least 2 recipients
  • All percentAllocation values must sum to exactly 100%
  • Each recipient address must be a valid Ethereum address
Splits structure:
  • splits is an array of objects, each containing:
    • address: The recipient's Ethereum address
    • percentAllocation: The percentage allocation (0-100)

To learn more about Splits Configuration, see the Splits Configuration Reference.

Sales Configuration

The salesConfig object controls how tokens are sold:

  • type: The sale type ("fixedPrice" or "erc20Mint")
  • pricePerToken: Price per token in wei (18 decimals). For example, "100000000000000000" represents 0.1 ETH
  • saleStart: Unix timestamp as a string indicating when the sale starts
  • saleEnd: Unix timestamp as a string indicating when the sale ends
  • currency: (Optional) ERC20 token address. If not provided, defaults to the native token (ETH)

To learn more about SalesConfig, see the SalesConfig Reference.