Start share merge
curl --request POST \
--url https://api.worm.wtf/share-merges/ \
--header 'Content-Type: application/json' \
--data '
{
"market_condition_id": "<string>",
"amount": "<string>"
}
'import requests
url = "https://api.worm.wtf/share-merges/"
payload = {
"market_condition_id": "<string>",
"amount": "<string>"
}
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({market_condition_id: '<string>', amount: '<string>'})
};
fetch('https://api.worm.wtf/share-merges/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.worm.wtf/share-merges/",
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([
'market_condition_id' => '<string>',
'amount' => '<string>'
]),
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 := "https://api.worm.wtf/share-merges/"
payload := strings.NewReader("{\n \"market_condition_id\": \"<string>\",\n \"amount\": \"<string>\"\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("https://api.worm.wtf/share-merges/")
.header("Content-Type", "application/json")
.body("{\n \"market_condition_id\": \"<string>\",\n \"amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.worm.wtf/share-merges/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"market_condition_id\": \"<string>\",\n \"amount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"pubkey": "HwqEtgeDoWHLqyMQgjwj7BGWmCrZ46m6y5bALMfYcGYY",
"message": "Program call payload to merge shares."
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 4313,
"slug": "share_merge_insufficient_shares",
"message": "Not enough available YES and NO shares to merge this amount.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -12,
"slug": "authentication_failed",
"message": "Invalid signature",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -14,
"slug": "permission_denied",
"message": "You do not have permission to perform this action.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 4306,
"slug": "share_merge_in_progress",
"message": "A merge on this market is already in progress.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 3042,
"slug": "gringotts_unavailable",
"message": "The signing service is temporarily unavailable. Please try again shortly.",
"details": []
}
}
Share Merges
Start share merge
Create a share merge draft. Must be signed and submitted.
POST
/
share-merges
/
Start share merge
curl --request POST \
--url https://api.worm.wtf/share-merges/ \
--header 'Content-Type: application/json' \
--data '
{
"market_condition_id": "<string>",
"amount": "<string>"
}
'import requests
url = "https://api.worm.wtf/share-merges/"
payload = {
"market_condition_id": "<string>",
"amount": "<string>"
}
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({market_condition_id: '<string>', amount: '<string>'})
};
fetch('https://api.worm.wtf/share-merges/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.worm.wtf/share-merges/",
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([
'market_condition_id' => '<string>',
'amount' => '<string>'
]),
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 := "https://api.worm.wtf/share-merges/"
payload := strings.NewReader("{\n \"market_condition_id\": \"<string>\",\n \"amount\": \"<string>\"\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("https://api.worm.wtf/share-merges/")
.header("Content-Type", "application/json")
.body("{\n \"market_condition_id\": \"<string>\",\n \"amount\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.worm.wtf/share-merges/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"market_condition_id\": \"<string>\",\n \"amount\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"pubkey": "HwqEtgeDoWHLqyMQgjwj7BGWmCrZ46m6y5bALMfYcGYY",
"message": "Program call payload to merge shares."
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 4313,
"slug": "share_merge_insufficient_shares",
"message": "Not enough available YES and NO shares to merge this amount.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -12,
"slug": "authentication_failed",
"message": "Invalid signature",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -14,
"slug": "permission_denied",
"message": "You do not have permission to perform this action.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 4306,
"slug": "share_merge_in_progress",
"message": "A merge on this market is already in progress.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 3042,
"slug": "gringotts_unavailable",
"message": "The signing service is temporarily unavailable. Please try again shortly.",
"details": []
}
}
Convert a complete set of outcome shares back into USDC: each
1 YES share plus 1 NO share becomes 1 USDC.
Share merges are available on open order book markets that do not have margin trading enabled. Other markets return share_conversion_market_not_eligible.
Creating a draft locks the YES and NO shares for amount until the merge finishes. Drafts expire quickly, so sign and submit promptly. An unsigned draft that expires moves to expired and releases the lock.
Body Parameters
string
required
Market condition id.
string
required
Complete sets to merge. This many YES shares and this many NO shares are burned and you receive this much USDC. Must be a positive multiple of the market’s lot size,
10^-amount_precision (see amount_precision on Get market by condition id). At most 6 decimal places.Sign the returned
message, then call Submit share merge with the hex signature (see that page). Track the result with Get share merge by pubkey.Response
On success the API returns201 Created with a Location header pointing to GET /share-merges/{pubkey}/.
object
Created share merge draft payload.
object
Empty object on success for this endpoint.
object | null
null on success. Error object on failed requests.Errors
| Status | Slug | When |
|---|---|---|
400 | invalid_request_params | Validation failed, for example the market is not found (details names the field). |
400 | share_conversion_market_not_eligible | The market does not support split and merge. |
400 | share_conversion_invalid_amount | amount is not a positive multiple of the market’s lot size. |
400 | share_merge_insufficient_shares | Your available YES or NO shares (not locked by open orders or other conversions) are below amount. |
403 | custodial_user_trading_not_allowed | Custodial accounts cannot use split and merge. |
409 | share_conversion_market_not_open | The market is not open. |
409 | share_conversion_market_paused | The market is paused on chain. |
409 | share_merge_in_progress | Another share merge on this market is waiting to be signed or in process. Repeating a request for an unsigned draft with the same amount returns that draft instead of this error. |
409 | share_merge_market_has_unbacked_collateral | Merging is temporarily unavailable on this market. |
503 | gringotts_unavailable | The signing service is temporarily unavailable. Retry shortly. |
{
"data": {
"pubkey": "HwqEtgeDoWHLqyMQgjwj7BGWmCrZ46m6y5bALMfYcGYY",
"message": "Program call payload to merge shares."
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 4313,
"slug": "share_merge_insufficient_shares",
"message": "Not enough available YES and NO shares to merge this amount.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -12,
"slug": "authentication_failed",
"message": "Invalid signature",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -14,
"slug": "permission_denied",
"message": "You do not have permission to perform this action.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 4306,
"slug": "share_merge_in_progress",
"message": "A merge on this market is already in progress.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": 3042,
"slug": "gringotts_unavailable",
"message": "The signing service is temporarily unavailable. Please try again shortly.",
"details": []
}
}