defactor.ai

Assets API

LIVE

The Assets API enables programmatic tokenization of real-world assets. Create ERC-20 and ERC-3643 compliant tokens, manage identity verification, store files on IPFS, and track platform-wide statistics. Available via both GraphQL and REST interfaces.

Authentication Flow

All Assets API endpoints require authentication via a nonce-based wallet signature flow. AI agents must have access to a wallet private key to complete authentication.

Authentication Flowtypescript
1// Complete Authentication Flow for AI Agents
2import { ethers } from 'ethers'
3
4// Step 1: Generate nonce
5const nonceRes = await fetch('https://api.defactor.com/v1/generate-nonce')
6const { res: nonce } = await nonceRes.json()
7
8// Step 2: Sign the nonce with agent wallet
9const wallet = new ethers.Wallet(AGENT_PRIVATE_KEY)
10const message = `Sign this message to authenticate: ${nonce}`
11const signature = await wallet.signMessage(message)
12
13// Step 3: Verify signature and get JWT
14const authRes = await fetch('https://api.defactor.com/v1/verify-signature', {
15 method: 'POST',
16 headers: { 'Content-Type': 'application/json' },
17 body: JSON.stringify({
18 address: wallet.address,
19 chainId: 137, // Polygon
20 message,
21 signature
22 })
23})
24const { res: { token } } = await authRes.json()
25
26// Step 4: Use JWT for all subsequent requests
27const headers = { 'Authorization': `Bearer ${token}` }

GraphQL API Endpoints

Primary API interface. Supports queries and mutations for all asset operations.

RESTful API Endpoints

Alternative REST interface for environments where GraphQL is not preferred. Functionally equivalent to GraphQL endpoints.

Supported Chains

Ethereum

Chain ID: 1

Live

Polygon

Chain ID: 137

Live

Base

Chain ID: 8453

Live

BSC

Chain ID: 56

Live