Skip to main content
POST
/
api
/
projects
Create project
curl --request POST \
  --url http://localhost:4000/api/projects \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_name": "My Project",
  "currency_symbol": "TON",
  "network_id": 1,
  "wallet_address": "<string>",
  "min_amount": "10.50",
  "max_amount": "10.50",
  "description": "<string>",
  "merchant_url": "<string>",
  "finalization_time": 1800
}
'
import requests

url = "http://localhost:4000/api/projects"

payload = {
"project_name": "My Project",
"currency_symbol": "TON",
"network_id": 1,
"wallet_address": "<string>",
"min_amount": "10.50",
"max_amount": "10.50",
"description": "<string>",
"merchant_url": "<string>",
"finalization_time": 1800
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
project_name: 'My Project',
currency_symbol: 'TON',
network_id: 1,
wallet_address: '<string>',
min_amount: '10.50',
max_amount: '10.50',
description: '<string>',
merchant_url: '<string>',
finalization_time: 1800
})
};

fetch('http://localhost:4000/api/projects', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_PORT => "4000",
CURLOPT_URL => "http://localhost:4000/api/projects",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'project_name' => 'My Project',
'currency_symbol' => 'TON',
'network_id' => 1,
'wallet_address' => '<string>',
'min_amount' => '10.50',
'max_amount' => '10.50',
'description' => '<string>',
'merchant_url' => '<string>',
'finalization_time' => 1800
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "http://localhost:4000/api/projects"

payload := strings.NewReader("{\n \"project_name\": \"My Project\",\n \"currency_symbol\": \"TON\",\n \"network_id\": 1,\n \"wallet_address\": \"<string>\",\n \"min_amount\": \"10.50\",\n \"max_amount\": \"10.50\",\n \"description\": \"<string>\",\n \"merchant_url\": \"<string>\",\n \"finalization_time\": 1800\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("http://localhost:4000/api/projects")
.header("Content-Type", "application/json")
.body("{\n \"project_name\": \"My Project\",\n \"currency_symbol\": \"TON\",\n \"network_id\": 1,\n \"wallet_address\": \"<string>\",\n \"min_amount\": \"10.50\",\n \"max_amount\": \"10.50\",\n \"description\": \"<string>\",\n \"merchant_url\": \"<string>\",\n \"finalization_time\": 1800\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:4000/api/projects")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"project_name\": \"My Project\",\n \"currency_symbol\": \"TON\",\n \"network_id\": 1,\n \"wallet_address\": \"<string>\",\n \"min_amount\": \"10.50\",\n \"max_amount\": \"10.50\",\n \"description\": \"<string>\",\n \"merchant_url\": \"<string>\",\n \"finalization_time\": 1800\n}"

response = http.request(request)
puts response.read_body
{
  "status": "ok",
  "message": "project_created",
  "project": {
    "id": 1,
    "project_uid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "project_name": "<string>",
    "wallet_address": "<string>",
    "currency_symbol": "<string>",
    "network_id": 123,
    "min_amount": "10.50",
    "max_amount": "10.50",
    "finalization_time": 1800,
    "is_active": true,
    "description": "<string>",
    "merchant_url": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  },
  "secret_key": "<string>"
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}
{
"status": "error",
"error": "invalid_request",
"reason": "<string>",
"detail": "<string>",
"field": "<string>",
"currency": "<string>",
"missing": [
"<string>"
],
"errors": {},
"message": "<string>",
"constraint": "<string>",
"tx_status": "<string>",
"project_uid": "<string>",
"widget_id": "<string>",
"expected": {}
}

Body

application/json
project_name
string
required
Maximum string length: 250
Example:

"My Project"

currency_symbol
string
required
Example:

"TON"

network_id
integer
required
Required range: x >= 1
Example:

1

wallet_address
string
required

Wallet address valid for the selected network

min_amount
required

Decimal amount accepted by the backend

Example:

"10.50"

max_amount
required

Decimal amount accepted by the backend

Example:

"10.50"

description
string | null
merchant_url
string<uri> | null
finalization_time
integer
default:1800
Required range: x >= 1

Response

Project created

status
enum<string>
required
Available options:
ok
message
enum<string>
required
Available options:
project_created
project
object
required
secret_key
string
required

Hex-encoded project secret key returned once on creation