BWS API Docs
Contact UsCreate AccountSign In
  • Welcome!
    • Developer Grants
  • Quick Start
  • Platform Fees
    • Fees Calculator
  • API How Tos
    • API Endpoint
    • Authentication
      • Get your API Key
    • Main API Methods
      • 'call' API Method
      • 'fetch' API Method
    • API Responses
      • Error Status Codes
  • Certificate Of Trust
  • Media Assets
    • BWS Logo
    • Snapshots
      • BWS.IPFS.Upload
  • PLATFORM APIs
    • BWS.IPFS.Upload
      • Solution Overview
      • Operations
    • BWS.Blockchain.Save
      • Solution Overview
      • Operations
    • BWS.Blockchain.Hash
      • Solution Overview
      • Operations
    • BWS.NFT.zK
      • Solution Overview
        • NFT Ownership
        • NFT Data Location
        • Available Networks
      • Operations
        • Create NFT
        • List NFTs
        • Transfer NFT
        • Send NFT by Email
      • NFT Attributes (traits)
  • Marketplace Solutions
    • BWS.Blockchain.Badges
      • Badges User Interface
      • Badges API
        • Issuers
        • Badges
        • Awards (Credentials)
    • BWS.NFT.GameCube
      • NFT Game Overview
      • NFT Game Cube API
        • Calendar
        • Field
        • Cubes
        • Plays (Field-Calendar)
        • Match
        • Prizes
        • Event Types
        • Live Events
    • BWS.ESG.Credits
      • Solution Overview
      • ESG Credits API
        • Taxonomy
        • Translations
        • Currencies
        • Frameworks
        • Projects
        • Issuers
        • Assets
        • Investors
        • Positions
        • Portfolios
        • Impacts
        • Blockchain
        • Users
  • TELEGRAM BOTS
    • X BOT
      • Install
        • BYOK (X API Token)
      • How does it work?
      • Commands
Powered by GitBook
On this page
  • Get your API key
  • Your First BWS API Request
  • Write "Hello World!" to Matchain blockchain.
  • Check for Status
  • Fetch for the blockchain job status and results.

Was this helpful?

Quick Start

Writing "Hello World!" to the blockchain in just one call!

PreviousWelcome!NextPlatform Fees

Last updated 4 months ago

Was this helpful?

Get your API key

Your API requests should be authenticated using your API key (any request that doesn't include an API key will return an error).

Learn how to .

Your First BWS API Request

We're going to use the solution to save a message to the blockchain.

Write "Hello World!" to Matchain blockchain.

POST https://api.bws.ninja/v1/smart-contracts/call

Let's write "Hello World!" to the Matchain blockchain network without managing network fees or Web3 wallets by calling a regular Web2 API.

Request Body

Name
Type
Description

solution*

string

BWS.Blockchain.Hash

version*

number

1

network*

string

matchain

operation*

string

insert

parameters*

JSON

{ key: "mykey",

value: "Hello World!"

}

Please copy & Paste one of the following code snippets and run it (remember to use your API Key).

curl --location 'https://api.bws.ninja/v1/smart-contracts/call' \
--header 'X-Api-Key: API-KEY' \
--header 'Content-Type: application/json' \
--data '{
    "solution": "BWS.Blockchain.Hash",
    "version": 1,
    "network": "matchain",
    "operation": "insert",
    "parameters": {
        "key": "timestamp: 1736418591440",
        "value": "Hola"
    }
}'
var settings = {
  "url": "https://api.bws.ninja/v1/call",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "X-Api-Key": "API-KEY",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
     "solution": "BWS.Blockchain.Hash",
    "version": 1,
    "network": "matchain",
    "operation": "insert",
    "parameters": {
        "key": "timestamp: 1736418591440",
        "value": "Hola"
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
import http.client
import json

conn = http.client.HTTPSConnection("api.bws.ninja")
payload = json.dumps({
    "solution": "BWS.Blockchain.Hash",
    "version": 1,
    "network": "matchain",
    "operation": "insert",
    "parameters": {
        "key": "timestamp: 1736418591440",
        "value": "Hola"
    }
})
headers = {
  'X-Api-Key': 'API-KEY',
  'Content-Type': 'application/json'
}
conn.request("POST", "/v1/call", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
{
    "statusCode": 200,
    "statusMessage": "",
    "info": {
        "jobId": "59d0f46b-0b58-4972-8aca-51d06f69f25e"
    }
}

Check for Status

To check for job completion and results, use the jobId you got from the previous call.

Please note that interacting with blockchain(s) is asynchronous, so it may take some time for the operation to finish and for the blockchain receipt to be received.

Fetch for the blockchain job status and results.

POST https://api.bws.ninja/v1/smart-contracts/fetch

Using the previous call response jobId we fetch the blockchain job started previously.

Request Body

Name
Type
Description

jobId*

String

(use previously returned jobId, as for example 59d0f46b-0b58-4972-8aca-51d06f69f25e)

Copy & Paste one of the following code snippets and run it (remember to use your own API Key).

curl --location 'https://api.bws.ninja/v1/fetch' \
--header 'X-Api-Key: API-KEY' \
--header 'Content-Type: application/json' \
--data '{
    "jobId": "59d0f46b-0b58-4972-8aca-51d06f69f25e"
}'
var settings = {
  "url": "https://api.bws.ninja/v1/fetch",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "X-Api-Key": "API-KEY",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "jobId": "59d0f46b-0b58-4512-8aca-51d06f69f25e"
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
import http.client
import json

conn = http.client.HTTPSConnection("api.bws.ninja")
payload = json.dumps({
  "jobId": "59d0f46b-0b58-4512-8aca-51d06f69f25e"
})
headers = {
  'X-Api-Key': 'API-KEY',
  'Content-Type': 'application/json'
}
conn.request("POST", "/v1/fetch", payload, headers)
res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))

You should receive a response indicating the completed job and the related blockchain receipt and certificate.

{
    "statusCode": 200,
    "info": {
        "status": {
            "Value": "completed"
        },
        "request": {
            "solution": "BWS.Blockchain.Hash",
            "version": 1,
            "network": "matchain",
            "operation": "insert",
            "parameters": {
                "key": "timestamp: 1736418591440",
                "value": "Hola"
            }
        },
        "hash": "0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8",
        "txnUrl": "https://matchscan.io/tx/0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8",
        "certificateOfTrust": "https://s3.amazonaws.com/bws-backoffice-website-infra-prod/tx/matchain/0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8.pdf",
        "certificateOfTrustJPG": "https://s3.amazonaws.com/bws-backoffice-website-infra-prod/tx/matchain/0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8.jpg",
        "certificateOfTrustUrl": "https://prod.bws.ninja/tx.html?t=0xd5c51886e57b1b16e59bd866910f2c689728f9e4025a4abc14bf7b07ae21dcc8",
        "type": {
            "value": "blockchain-job"
        },
        "timestampInMillis": 1736418605359,
        "id": "a89bf8bf-392b-4cc3-8ded-7dbe9d43c341"
    }
}

Congratulations! In just one call, you used BWS to save data into the Web3 blockchain ecosystem.

If executed correctly, check forjobId in the response body part. We will use it to verify that the blockchain operation has been completed correctly and to receive the blockchain transaction receipt and .

Get your API Key
BWS.Blockchain.Hash
Certificate of Trust