W3Block Docs
  • 🚀Start here
    • Welcome to the Docs
    • Integrated Blockchains
  • 👨‍💻Dev Docs
    • API
      • Getting Started
      • Authentication
      • Commerce API services
        • Company Administration
          • Companies (Admin)
          • Assets (Admin)
          • Tags (Admin)
          • Products (Admin)
            • Order Rules (Admin)
          • Orders (Admin)
          • Faq (Admin)
          • Webhooks (Admin)
        • Products
        • Orders
        • Webhooks
        • Faq
        • Globals
      • Key API Services
        • Authentication
        • Companies
        • Tokens
          • Contracts
            • External Contacts
            • Royalty Eligible
          • Categories
            • Subcategories
          • Token Collections
            • Token Editions
          • Metadata
        • Blockchain
        • Cloudinary
        • Integration
          • Ecommerce
            • Associate Tokens
            • Hooks
        • Users
        • Vouchers
  • 📘Knowledge Base
    • First Steps
    • FAQ
    • Glossary
Powered by GitBook
On this page
  1. Dev Docs
  2. API
  3. Key API Services
  4. Tokens

Contracts

This module helps you administer your contracts in the blockchain

PreviousTokensNextExternal Contacts

Last updated 2 years ago

Contracts are what you use to create your tokens inside the blockchain. You can create your own contracts and use them however you like.

Service Methods

Creating a Draft

Before you do anything you need to create a draft for the contract. You will set all the parameters you will need to publishing the contract.

Get all contracts from your company

Get a contract's details

Patch a Contract Draft

Publishing a Contract

After you have created a draft you can publish the contract. Be careful as you will not be able to change the contract details after publishing it.

Estimate gas to publish a contract

Grant a wallet a role for your contract

Grant a wallets role in your contract

👨‍💻
get

Get all contract from a company

Authorizations
Path parameters
companyIdstringRequired
Query parameters
pagenumberOptionalDefault: 1
limitnumberOptionalDefault: 1000
searchstringOptional
sortBystringOptional
orderBystring · enumOptionalDefault: DESCPossible values:
statusstring · enumOptionalPossible values:
contractNamestringOptional
minDatestringOptionalExample: 2022-02-15T10:30:05-03:00
maxDatestringOptionalExample: 2022-02-15T10:30:05-03:00
contactIdstringOptional
participantNamestringOptional
walletAddressesstring[]Optional
Responses
200Success
application/json
401
Need user with one of these roles: superAdmin, admin
get
GET /{companyId}/contracts HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Accept: */*
{
  "meta": {
    "itemCount": 1,
    "totalItems": 1,
    "itemsPerPage": 1,
    "totalPages": 1,
    "currentPage": 1
  },
  "links": {
    "first": "http://example.com?page=1",
    "prev": "http://example.com?page=1",
    "next": "http://example.com?page=2",
    "last": "http://example.com?page=3"
  },
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "companyId": "123e4567-e89b-12d3-a456-426614174000",
      "royalty": {},
      "royaltyId": "123e4567-e89b-12d3-a456-426614174000",
      "address": "text",
      "chainId": 1,
      "name": "text",
      "symbol": "text",
      "description": "text",
      "image": "text",
      "externalLink": "text",
      "operators": [
        "text"
      ],
      "roles": [
        []
      ],
      "status": "draft",
      "contractAction": {
        "id": "text",
        "companyId": "text",
        "status": "started",
        "type": "factoryERC721A",
        "chainId": 80001,
        "sender": "text",
        "txHash": "text",
        "txId": "text",
        "metadata": {},
        "request": {},
        "executeAt": "2025-06-01T17:11:16.218Z",
        "deletedAt": "2025-06-01T17:11:16.218Z",
        "createdAt": "2025-06-01T17:11:16.218Z",
        "updatedAt": "2025-06-01T17:11:16.218Z"
      },
      "contractActionId": "text",
      "features": [
        "admin:minter"
      ],
      "deletedAt": "2025-06-01T17:11:16.218Z",
      "createdAt": "2025-06-01T17:11:16.218Z",
      "updatedAt": "2025-06-01T17:11:16.218Z",
      "transferWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
      "minterWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
      "maxSupply": 1
    }
  ]
}
get

Get a contract by id

Authorizations
Path parameters
idstringRequired
companyIdstringRequired
Responses
200Success
application/json
401
Need user with one of these roles: superAdmin, admin
get
GET /{companyId}/contracts/{id} HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Accept: */*
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "companyId": "123e4567-e89b-12d3-a456-426614174000",
  "royalty": {},
  "royaltyId": "123e4567-e89b-12d3-a456-426614174000",
  "address": "text",
  "chainId": 1,
  "name": "text",
  "symbol": "text",
  "description": "text",
  "image": "text",
  "externalLink": "text",
  "operators": [
    "text"
  ],
  "roles": [
    []
  ],
  "status": "draft",
  "contractAction": {
    "id": "text",
    "companyId": "text",
    "status": "started",
    "type": "factoryERC721A",
    "chainId": 80001,
    "sender": "text",
    "txHash": "text",
    "txId": "text",
    "metadata": {},
    "request": {},
    "executeAt": "2025-06-01T17:11:16.218Z",
    "deletedAt": "2025-06-01T17:11:16.218Z",
    "createdAt": "2025-06-01T17:11:16.218Z",
    "updatedAt": "2025-06-01T17:11:16.218Z"
  },
  "contractActionId": "text",
  "features": [
    "admin:minter"
  ],
  "deletedAt": "2025-06-01T17:11:16.218Z",
  "createdAt": "2025-06-01T17:11:16.218Z",
  "updatedAt": "2025-06-01T17:11:16.218Z",
  "transferWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
  "minterWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
  "maxSupply": 1
}
patch

Publish a contract on the blockchain

Authorizations
Path parameters
idstringRequired
companyIdstringRequired
Responses
204Success
401
Need user with one of these roles: superAdmin, admin
patch
PATCH /{companyId}/contracts/{id}/publish HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Accept: */*

No content

get

Estimate gas to publish a contract

Authorizations
Path parameters
idstringRequired
companyIdstringRequired
Responses
200Success
application/json
401
Need user with one of these roles: superAdmin, admin
get
GET /{companyId}/contracts/{id}/estimate-gas HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Accept: */*
{
  "totalGas": 1,
  "totalGasPrice": {
    "safe": "text",
    "proposed": "text",
    "fast": "text"
  }
}
  • Service Methods
  • Creating a Draft
  • POST/{companyId}/contracts
  • Get all contracts from your company
  • GET/{companyId}/contracts
  • Get a contract's details
  • GET/{companyId}/contracts/{id}
  • Patch a Contract Draft
  • PATCH/{companyId}/contracts/{id}
  • Publishing a Contract
  • PATCH/{companyId}/contracts/{id}/publish
  • Estimate gas to publish a contract
  • GET/{companyId}/contracts/{id}/estimate-gas
  • Grant a wallet a role for your contract
  • PATCH/{companyId}/contracts/grant-role
  • Grant a wallets role in your contract
  • PATCH/{companyId}/contracts/has-role
post

Create a new contract draft

Authorizations
Path parameters
companyIdstringRequired
Body
namestringRequiredExample: Contract Example
symbolstringRequiredExample: CE
chainIdstring · enumRequiredDefault: 1Example: 1Possible values:
descriptionobjectOptional
imageobjectOptionalExample: https://dummyimage.com/600x400/fff/000
externalLinkobjectOptionalExample: https://stg.pixway.io
transferWhitelistIdobject · uuidOptional
minterWhitelistIdobject · uuidOptional
Responses
201Success
application/json
401
Need user with one of these roles: superAdmin, admin
post
POST /{companyId}/contracts HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 414

{
  "name": "Contract Example",
  "symbol": "CE",
  "chainId": 1,
  "description": {},
  "image": "https://dummyimage.com/600x400/fff/000",
  "externalLink": "https://stg.pixway.io",
  "participants": [
    {
      "contactId": null,
      "share": 2.5,
      "name": "Participant 1",
      "payee": "0x095358452C33916513a3827a2D086da1aCEd7EE0"
    }
  ],
  "features": [
    "admin:mover",
    "admin:minter",
    "admin:burner",
    "user:burner",
    "user:mover"
  ],
  "transferWhitelistId": {},
  "minterWhitelistId": {}
}
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "companyId": "123e4567-e89b-12d3-a456-426614174000",
  "royalty": {},
  "royaltyId": "123e4567-e89b-12d3-a456-426614174000",
  "address": "text",
  "chainId": 1,
  "name": "text",
  "symbol": "text",
  "description": "text",
  "image": "text",
  "externalLink": "text",
  "operators": [
    "text"
  ],
  "roles": [
    []
  ],
  "status": "draft",
  "contractAction": {
    "id": "text",
    "companyId": "text",
    "status": "started",
    "type": "factoryERC721A",
    "chainId": 80001,
    "sender": "text",
    "txHash": "text",
    "txId": "text",
    "metadata": {},
    "request": {},
    "executeAt": "2025-06-01T17:11:16.218Z",
    "deletedAt": "2025-06-01T17:11:16.218Z",
    "createdAt": "2025-06-01T17:11:16.218Z",
    "updatedAt": "2025-06-01T17:11:16.218Z"
  },
  "contractActionId": "text",
  "features": [
    "admin:minter"
  ],
  "deletedAt": "2025-06-01T17:11:16.218Z",
  "createdAt": "2025-06-01T17:11:16.218Z",
  "updatedAt": "2025-06-01T17:11:16.218Z",
  "transferWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
  "minterWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
  "maxSupply": 1
}
patch

Update a draft contract by id

Authorizations
Path parameters
idstringRequired
companyIdstringRequired
Body
namestringOptionalExample: Contract Example
symbolstringOptionalExample: CE
chainIdstring · enumOptionalDefault: 1Example: 1Possible values:
descriptionobjectOptional
imageobjectOptionalExample: https://dummyimage.com/600x400/fff/000
externalLinkobjectOptionalExample: https://stg.pixway.io
transferWhitelistIdobject · uuidOptional
minterWhitelistIdobject · uuidOptional
Responses
200Success
application/json
401
Need user with one of these roles: superAdmin, admin
patch
PATCH /{companyId}/contracts/{id} HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 414

{
  "name": "Contract Example",
  "symbol": "CE",
  "chainId": 1,
  "description": {},
  "image": "https://dummyimage.com/600x400/fff/000",
  "externalLink": "https://stg.pixway.io",
  "participants": [
    {
      "contactId": null,
      "share": 2.5,
      "name": "Participant 1",
      "payee": "0x095358452C33916513a3827a2D086da1aCEd7EE0"
    }
  ],
  "features": [
    "admin:mover",
    "admin:minter",
    "admin:burner",
    "user:burner",
    "user:mover"
  ],
  "transferWhitelistId": {},
  "minterWhitelistId": {}
}
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "companyId": "123e4567-e89b-12d3-a456-426614174000",
  "royalty": {},
  "royaltyId": "123e4567-e89b-12d3-a456-426614174000",
  "address": "text",
  "chainId": 1,
  "name": "text",
  "symbol": "text",
  "description": "text",
  "image": "text",
  "externalLink": "text",
  "operators": [
    "text"
  ],
  "roles": [
    []
  ],
  "status": "draft",
  "contractAction": {
    "id": "text",
    "companyId": "text",
    "status": "started",
    "type": "factoryERC721A",
    "chainId": 80001,
    "sender": "text",
    "txHash": "text",
    "txId": "text",
    "metadata": {},
    "request": {},
    "executeAt": "2025-06-01T17:11:16.218Z",
    "deletedAt": "2025-06-01T17:11:16.218Z",
    "createdAt": "2025-06-01T17:11:16.218Z",
    "updatedAt": "2025-06-01T17:11:16.218Z"
  },
  "contractActionId": "text",
  "features": [
    "admin:minter"
  ],
  "deletedAt": "2025-06-01T17:11:16.218Z",
  "createdAt": "2025-06-01T17:11:16.218Z",
  "updatedAt": "2025-06-01T17:11:16.218Z",
  "transferWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
  "minterWhitelistId": "123e4567-e89b-12d3-a456-426614174000",
  "maxSupply": 1
}
patch

Grant role by wallet address in an NFT contract

Authorizations
Path parameters
companyIdstringRequired
Body
addressstringRequiredExample: 0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188
chainIdstring · enumRequiredDefault: 1Example: 1Possible values:
rolestring · enumRequiredDefault: moverExample: moverPossible values:
contractAddressstringRequiredExample: 0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188
Responses
204Success
401
Need user with one of these roles: superAdmin, admin, integration
patch
PATCH /{companyId}/contracts/grant-role HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 146

{
  "address": "0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188",
  "chainId": 1,
  "role": "mover",
  "contractAddress": "0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188"
}

No content

patch

Check address role

Authorizations
Path parameters
companyIdstringRequired
Body
addressstringRequiredExample: 0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188
chainIdstring · enumRequiredDefault: 1Example: 1Possible values:
rolestring · enumRequiredDefault: moverExample: moverPossible values:
contractAddressstringRequiredExample: 0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188
Responses
200Success
application/json
401
Need user with one of these roles: superAdmin, admin, integration
patch
PATCH /{companyId}/contracts/has-role HTTP/1.1
Host: 
x-w3block-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 146

{
  "address": "0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188",
  "chainId": 1,
  "role": "mover",
  "contractAddress": "0xDAA50a02340cBcFA1a6F4c02765430Ffe411b188"
}
{
  "hasRole": true
}