Content API

The Content API allows creators to publish and manage articles on Zing Protocol. Content is stored on Walrus Protocol (decentralized storage) and encrypted with SEAL Protocol for access control.

The Article Model

The article model contains all information about published content:

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the article (also the Walrus blob ID).

  • Name
    creator_address
    Type
    string
    Description

    The Sui address of the content creator.

  • Name
    title
    Type
    string
    Description

    The title of the article.

  • Name
    preview
    Type
    string
    Description

    A short preview of the content (first 300 characters).

  • Name
    preview_image
    Type
    string
    Description

    URL to the preview image (optional).

  • Name
    access_tier
    Type
    enum
    Description

    Access level: public, basic, premium, or ultra.

  • Name
    size_bytes
    Type
    integer
    Description

    The size of the content in bytes.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the article was published.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the article was last updated.

  • Name
    likes
    Type
    integer
    Description

    Number of likes on the article.


POST/v1/articles

Create Article

Create a new article. The content is uploaded to Walrus storage and encrypted based on the access tier.

Required attributes

  • Name
    title
    Type
    string
    Description

    The title of the article (max 200 characters).

  • Name
    content
    Type
    string
    Description

    The article content in Markdown format.

  • Name
    access_tier
    Type
    enum
    Description

    Access level: public, basic, premium, or ultra.

Optional attributes

  • Name
    preview_image
    Type
    string
    Description

    URL to a preview image for the article.

  • Name
    epochs
    Type
    integer
    Description

    Number of epochs to store the content (default: 2).

Request

POST
/v1/articles
curl https://api.zing.protocol/v1/articles \
  -H "Authorization: Bearer {jwt_token}" \
  -d title="My First Article" \
  -d content="# Hello World..." \
  -d access_tier="premium"

GET/v1/articles

List Articles

Retrieve a paginated list of articles. Supports filtering by creator and access tier.

Query parameters

  • Name
    creator
    Type
    string
    Description

    Filter by creator Sui address.

  • Name
    tier
    Type
    enum
    Description

    Filter by access tier: public, basic, premium, ultra.

  • Name
    limit
    Type
    integer
    Description

    Number of articles to return (default: 10, max: 100).

  • Name
    cursor
    Type
    string
    Description

    Pagination cursor for next page.

Request

GET
/v1/articles
curl https://api.zing.protocol/v1/articles \
  -H "Authorization: Bearer {jwt_token}" \
  -d limit=10

GET/v1/articles/:id

Get Article

Retrieve a single article by its ID. Returns the full content if the user has the required access tier.

Path parameters

  • Name
    id
    Type
    string
    Description

    The article ID (Walrus blob ID).

Request

GET
/v1/articles/walrus_blob_abc123
curl https://api.zing.protocol/v1/articles/walrus_blob_abc123 \
  -H "Authorization: Bearer {jwt_token}"

PUT/v1/articles/:id

Update Article

Update an article's metadata. Only the creator can update their articles.

Optional attributes

  • Name
    title
    Type
    string
    Description

    New title for the article.

  • Name
    access_tier
    Type
    enum
    Description

    New access tier: public, basic, premium, or ultra.

  • Name
    preview_image
    Type
    string
    Description

    New preview image URL.

Request

PUT
/v1/articles/walrus_blob_abc123
curl -X PUT https://api.zing.protocol/v1/articles/walrus_blob_abc123 \
  -H "Authorization: Bearer {jwt_token}" \
  -d title="Updated Title" \
  -d access_tier="ultra"

DELETE/v1/articles/:id

Delete Article

Delete an article. Only the creator can delete their articles. This removes the content from Walrus storage.

Request

DELETE
/v1/articles/walrus_blob_abc123
curl -X DELETE https://api.zing.protocol/v1/articles/walrus_blob_abc123 \
  -H "Authorization: Bearer {jwt_token}"

POST/v1/articles/:id/like

Like Article

Like an article. Users can like articles from creators they support.

Request

POST
/v1/articles/walrus_blob_abc123/like
curl -X POST https://api.zing.protocol/v1/articles/walrus_blob_abc123/like \
  -H "Authorization: Bearer {jwt_token}"

Access Tiers

TierDescriptionWho Can View
publicAnyone can viewAll users
basicRequires Basic membershipBasic+ members
premiumRequires Premium membershipPremium+ members
ultraRequires Ultra membershipUltra members only

Storage Cost

Content storage on Walrus has an associated cost:

// Storage cost calculation
const { encodedSize, writeCost } = storageCost(
  walrusSystemState,
  contentSizeBytes,
  epochs, // Default 2
)

// Cost is deducted from Creator Energy (storage balance)

Was this page helpful?