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, orultra.
- 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.
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, orultra.
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
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"
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
curl https://api.zing.protocol/v1/articles \
-H "Authorization: Bearer {jwt_token}" \
-d limit=10
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
curl https://api.zing.protocol/v1/articles/walrus_blob_abc123 \
-H "Authorization: Bearer {jwt_token}"
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, orultra.
- Name
preview_image- Type
- string
- Description
New preview image URL.
Request
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 Article
Delete an article. Only the creator can delete their articles. This removes the content from Walrus storage.
Request
curl -X DELETE https://api.zing.protocol/v1/articles/walrus_blob_abc123 \
-H "Authorization: Bearer {jwt_token}"
Like Article
Like an article. Users can like articles from creators they support.
Request
curl -X POST https://api.zing.protocol/v1/articles/walrus_blob_abc123/like \
-H "Authorization: Bearer {jwt_token}"
Access Tiers
| Tier | Description | Who Can View |
|---|---|---|
| public | Anyone can view | All users |
| basic | Requires Basic membership | Basic+ members |
| premium | Requires Premium membership | Premium+ members |
| ultra | Requires Ultra membership | Ultra 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)
Creator Energy: Storage is managed through Creator Energy credits. Basic tier provides ~5GB free, with paid tiers offering more storage.