templates_submit
POST
/templates
const url = 'https://example.com/templates';const options = {method: 'POST', headers: {'Content-Type': 'text/plain'}, body: 'example'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/templates \ --header 'Content-Type: text/plain' \ --data exampleCompile, validate, and store a template from its source.
The compiled template is content-addressed by its SHA-256 hash, so submitting the same source twice returns the same template ID.
Request Body required
Section titled “Request Body required ” Media type text/plain
string
Responses
Section titled “ Responses ”Template created
Media type application/json
Response returned when a template is successfully created.
object
template_id
required
Content-addressed ID of the stored template (base58-encoded SHA-256 of the compiled template bytes).
string
Example generated
{ "template_id": "example"}Compilation error
Media type application/json
object
message
required
string
Example generated
{ "message": "example"}Internal error
Media type application/json
object
message
required
string
Example generated
{ "message": "example"}