Terms of Use
Unpublish Terms
Take a market terms of use offline without deleting them
DELETE
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
terms
curl -X DELETE "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/terms" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/terms`,
{ method: 'DELETE', headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { success, data, error } = await res.json();
if (!success) throw new Error(`${error.code}: ${error.message}`);
console.log(data.unpublished ? 'Terms are offline' : 'The market never had terms');
{
"success": true,
"data": {
"unpublished": true
}
}
{
"success": false,
"error": {
"code": "NOT_CURATOR",
"message": "This market has no lender of record yet. The terms of use are authored by the lender once it has taken the role."
}
}
Takes the market’s terms of use offline. Get Terms answers
TERMS_NOT_PUBLISHED for every instance from then on, and loan builds on the market, Open Loan and Borrow More, carry a TERMS_NOT_PUBLISHED warning. Nothing on chain changes and nothing is signed.
Despite the method, nothing is deleted. The text stays stored, every version stays readable through Get Terms Version, and no new version is written, so the version number does not move. A later Save Terms with published left at true puts the terms back online as a new version.
The same authority check as Save Terms applies. One of this instance’s verified wallets must be the lender of record recorded on the factory, or hold the market’s admin role or issuer role.
Path Parameters
string
required
Response Fields
object
Show child attributes
Show child attributes
boolean
true whenever the market has a terms record, including one that was already offline. false only when the market never had terms.curl -X DELETE "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/terms" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/terms`,
{ method: 'DELETE', headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { success, data, error } = await res.json();
if (!success) throw new Error(`${error.code}: ${error.message}`);
console.log(data.unpublished ? 'Terms are offline' : 'The market never had terms');
{
"success": true,
"data": {
"unpublished": true
}
}
{
"success": false,
"error": {
"code": "NOT_CURATOR",
"message": "This market has no lender of record yet. The terms of use are authored by the lender once it has taken the role."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
MISSING_MARKET_ID | 400 | The market ID is longer than 100 characters |
NO_MARKET_ADDRESS | 400 | The market has no on-chain address |
TERMS_DELETE_FAILED | 400 | The update failed for a reason the service did not classify |
NOT_CURATOR | 403 | No verified wallet of this instance is the lender of record or holds the market’s admin or issuer role |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
WALLET_NOT_CONFIGURED | 412 | This instance has no verified wallet |
MARKET_UNREADABLE | 503 | The market’s roles could not be read on chain, so authority could not be established. Retry shortly |
⌘I
curl -X DELETE "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/terms" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/terms`,
{ method: 'DELETE', headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { success, data, error } = await res.json();
if (!success) throw new Error(`${error.code}: ${error.message}`);
console.log(data.unpublished ? 'Terms are offline' : 'The market never had terms');
{
"success": true,
"data": {
"unpublished": true
}
}
{
"success": false,
"error": {
"code": "NOT_CURATOR",
"message": "This market has no lender of record yet. The terms of use are authored by the lender once it has taken the role."
}
}
