Rest API

TLOCK API Documentation

Overview

TLOCK provides REST and gRPC APIs for interacting with the decentralized social media platform. All APIs are automatically generated from Protocol Buffer definitions and follow Cosmos SDK standards.

Base Configuration

Network Information

  • Chain ID: localchain-1 (testnet) / tlock-1 (mainnet)

  • Bech32 Prefix: tlock

  • Native Token: TOK

  • Cosmos SDK Version: v0.50

  • Tendermint Version: v0.38

Endpoints

  • REST API: http://localhost:1317 (local) / https://api.tlock.org (mainnet)

  • RPC: http://localhost:26657 (local) / https://rpc.tlock.org (mainnet)

  • gRPC: localhost:9090 (local) / grpc.tlock.org:443 (mainnet)

Authentication

TLOCK uses Cosmos SDK standard authentication with cryptographic signatures. No API keys required.

Transaction Signing

All write operations require proper transaction signing using your wallet's private key.

Periodic Allowance

Users with granted periodic allowances can perform transactions without holding TOK tokens.

Post Module APIs

Query Endpoints (GET)

Get Module Parameters

Response: Module configuration parameters

Resolve Name

Parameters:

  • address: User's wallet address

Response:

Get Home Posts

Parameters:

  • page_size: Number of posts per page

Response:

Get First Page Home Posts

Parameters:

  • page: Page number

  • page_size: Number of posts per page

Search Topics

Parameters:

  • matching: Search term for topic matching

Response:

Get Topic Posts

Parameters:

  • topic_id: Topic identifier

  • page: Page number

Get Specific Post

Parameters:

  • post_id: Post identifier

Response:

Get User Created Posts

Parameters:

  • address: User's wallet address

  • page: Page number

Get Likes I Made

Get Saves I Made

Get Likes Received

Get Comments

Parameters:

  • id: Post or comment ID

  • page: Page number

Get Comments Received

Get Activities Received

Get Categories

Response:

Get Topics by Category

Get Category by Topic

Get Category Posts

Get Following Posts

Get Following Topics

Check if Following Topic

Response:

Get Uncategorized Topics

Get Vote Option

Get Topic Image

Get Topic Details

Get Trending Keywords

Get Trending Topics

Get Paid Post Image

Transaction Endpoints (POST)

All transaction endpoints require proper Cosmos SDK transaction formatting and signing.

Create Post

Endpoint: /cosmos/tx/v1beta1/txs Message Type: MsgCreatePost

Message Structure:

Like Post

Message Type: MsgLikeRequest

Unlike Post

Message Type: MsgUnlikeRequest

Comment on Post

Message Type: MsgCommentRequest

Quote Post

Message Type: MsgQuotePostRequest

Repost

Message Type: MsgRepostRequest

Save Post

Message Type: MsgSaveRequest

Cast Vote on Poll

Message Type: CastVoteOnPollRequest

Follow Topic

Message Type: MsgFollowTopicRequest

Grant Allowance from Module

Message Type: MsgGrantAllowanceFromModuleRequest

Profile Module APIs

Query Endpoints (GET)

Get Module Parameters

Get Profile

Response:

Get Profile Avatar

Get Following List

Get Followers List

Get Follow Relationship

Response:

Relationship codes: 0-No relationship; 1-A follows B; 2-B follows A; 3-Mutual follows

Get Mention Suggestions

Get Activities Received Count

Search Users

Check if Admin

Transaction Endpoints (POST)

Add/Update Profile

Message Type: MsgAddProfileRequest

Follow User

Message Type: MsgFollowRequest

Unfollow User

Message Type: MsgUnfollowRequest

Add Admin

Message Type: MsgAddAdminRequest

Manage Admin

Message Type: MsgManageAdminRequest

Standard Cosmos SDK APIs

TLOCK includes all standard Cosmos SDK modules with their respective APIs:

Bank Module

  • Base Path: /cosmos/bank/v1beta1/

  • Endpoints: balances, supply, metadata, etc.

Auth Module

  • Base Path: /cosmos/auth/v1beta1/

  • Endpoints: accounts, params

Staking Module

  • Base Path: /cosmos/staking/v1beta1/

  • Endpoints: validators, delegations, unbonding

Governance Module

  • Base Path: /cosmos/gov/v1beta1/

  • Endpoints: proposals, votes, params

Distribution Module

  • Base Path: /cosmos/distribution/v1beta1/

  • Endpoints: rewards, commission

Fee Grant Module

  • Base Path: /cosmos/feegrant/v1beta1/

  • Endpoints: allowances

IBC Module

  • Base Path: /ibc/

  • Endpoints: channels, connections, clients

Transaction Broadcasting

Transaction Query

Node Info

Block Info

Data Structures

PostResponse

Profile

TopicResponse

CategoryResponse

CommentResponse

Error Handling

Standard HTTP Status Codes

  • 200: Success

  • 400: Bad Request - Invalid parameters

  • 404: Not Found - Resource doesn't exist

  • 500: Internal Server Error

Cosmos SDK Error Format

Common Errors

Transaction Errors

Validation Errors

Authentication Errors

Rate Limiting

Default Limits

  • Query Endpoints: 1000 requests per hour per IP

  • Transaction Endpoints: 100 transactions per hour per address

  • Search Endpoints: 500 requests per hour per IP

Headers

Development Tools

CLI Commands

gRPC Clients

Swagger/OpenAPI

  • Local: http://localhost:1317/swagger/

  • Mainnet: https://api.tlock.org/swagger/

Support and Resources

Documentation

  • Cosmos SDK Docs: https://docs.cosmos.network

  • Protocol Buffers: https://developers.google.com/protocol-buffers

Community


This API documentation is automatically generated from Protocol Buffer definitions and reflects the actual implementation in the codebase.

Last updated