Create Configuration Template
1 min
POST
https://api.upstartcommerce.com/v1/tenants/cfg/templates
Header Parameters
- x-upstart-tenantstringrequiredDescription
Body Parameters
- bodyCreateCfgTemplaterequiredExample
{ "templateId": "payment-stripe", "name": "Stripe Payment Gateway Configuration", "propertiesDec": { "type": "object", "properties": { "apiKey": { "type": "string", "format": "password", "description": "Stripe secret API key", "minLength": 32 }, "publishableKey": { "type": "string", "description": "Stripe publishable API key" }, "webhookSecret": { "type": "string", "format": "password", "description": "Webhook signing secret" }, "currency": { "type": "string", "enum": [ "USD", "EUR", "GBP" ], "default": "USD" } }, "required": [ "apiKey", "publishableKey" ] }, "enabled": true, "accessControl": { "read": true, "modify": true } }Description- templateIdstringExampleDescription
- namestringrequiredExampleDescription
- propertiesDecobjectrequiredExample
{ "type": "object", "properties": { "merchantId": { "type": "string", "description": "Merchant identifier from Cybersource", "pattern": "^[a-zA-Z0-9_-]+$" }, "apiKey": { "type": "string", "description": "API key for authentication", "format": "password", "minLength": 32 }, "apiUrl": { "type": "string", "format": "uri", "default": "https://api.cybersource.com", "description": "Cybersource API base URL" }, "currency": { "type": "string", "enum": [ "USD", "EUR", "GBP" ], "default": "USD", "description": "Default currency for transactions" }, "testMode": { "type": "boolean", "default": false, "description": "Enable test mode for development" } }, "required": [ "merchantId", "apiKey" ] }Description - enabledbooleanrequiredExampleDescription
- accessControlCfgAccessControlDescription
- readbooleanrequiredExampleDescription
- modifybooleanrequiredDescription
Responses
201
400
- ValidationErrorResponseExample
{ "name": "ValidationError", "code": "SCHEMA_VALIDATION_FAILED", "detail": "Configuration data validation failed: data.apiKey is required but was not provided. Expected string with minimum length 32." }Description- namestringrequiredExampleDescription
- codestringrequiredExampleDescription
- detailstringExampleDescription
401
- ErrorResponseExample
{ "name": "AuthorizationError", "code": "INSUFFICIENT_PERMISSIONS", "detail": "User does not have the required tenant.cfg.modify permission to perform this operation.", "reason": "Your access token does not include the necessary permissions. Contact your administrator to request access." }Description- namestringrequiredExampleDescription
- codestringrequiredExampleDescription
- detailstringrequiredExampleDescription
- reasonstringExampleDescription
409
- ErrorResponseExample
{ "name": "ConflictError", "code": "TEMPLATE_ID_ALREADY_EXISTS", "detail": "A configuration template with the ID \"payment-cybersource\" already exists in the tenant.", "reason": "Template IDs must be unique within a tenant. Please choose a different template ID or update the existing template." }Description- namestringrequiredExampleDescription
- codestringrequiredExampleDescription
- detailstringrequiredExampleDescription
- reasonstringExampleDescription
422
- ErrorResponseExample
{ "name": "UnprocessableEntityError", "code": "TEMPLATE_IN_USE", "detail": "Cannot delete template \"payment-cybersource\" because 5 configuration records are still using it.", "reason": "Delete or migrate all records using this template before deleting the template itself." }Description- namestringrequiredExampleDescription
- codestringrequiredExampleDescription
- detailstringrequiredExampleDescription
- reasonstringExampleDescription
500
- ErrorResponseExample
{ "name": "InternalServerError", "code": "UNEXPECTED_ERROR", "detail": "An unexpected error occurred while processing your request.", "reason": "Our team has been notified. Please try again, and if the problem persists, contact support with trace ID: 550e8400-e29b-41d4-a716-446655440000" }Description- namestringrequiredExampleDescription
- codestringrequiredExampleDescription
- detailstringrequiredExampleDescription
- reasonstringExampleDescription
curl
curl --request POST \
--url https://api.upstartcommerce.com/v1/tenants/cfg/templates \
--header 'accept: text/plain' \
--header 'content-type: application/json' \
--header 'x-upstart-tenant: string' \
--data '{
"name": "Cybersource Payment Gateway Configuration",
"propertiesDec": "{\"type\":\"object\",\"properties\":{\"merchantId\":{\"type\":\"string\",\"description\":\"Merchant identifier from Cybersource\",\"pattern\":\"^[a-zA-Z0-9_-]+$\"},\"apiKey\":{\"type\":\"string\",\"description\":\"API key for authentication\",\"format\":\"password\",\"minLength\":32},\"apiUrl\":{\"type\":\"string\",\"format\":\"uri\",\"default\":\"https://api.cybersource.com\",\"description\":\"Cybersource API base URL\"},\"currency\":{\"type\":\"string\",\"enum\":[\"USD\",\"EUR\",\"GBP\"],\"default\":\"USD\",\"description\":\"Default currency for transactions\"},\"testMode\":{\"type\":\"boolean\",\"default\":false,\"description\":\"Enable test mode for development\"}},\"required\":[\"merchantId\",\"apiKey\"]}",
"enabled": true,
"accessControl": {
"read": true,
"modify": false
}
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "text/plain");
myHeaders.append("content-type", "application/json");
myHeaders.append("x-upstart-tenant", "string");
var raw = JSON.stringify({
"name": "Cybersource Payment Gateway Configuration",
"propertiesDec": "{\"type\":\"object\",\"properties\":{\"merchantId\":{\"type\":\"string\",\"description\":\"Merchant identifier from Cybersource\",\"pattern\":\"^[a-zA-Z0-9_-]+$\"},\"apiKey\":{\"type\":\"string\",\"description\":\"API key for authentication\",\"format\":\"password\",\"minLength\":32},\"apiUrl\":{\"type\":\"string\",\"format\":\"uri\",\"default\":\"https://api.cybersource.com\",\"description\":\"Cybersource API base URL\"},\"currency\":{\"type\":\"string\",\"enum\":[\"USD\",\"EUR\",\"GBP\"],\"default\":\"USD\",\"description\":\"Default currency for transactions\"},\"testMode\":{\"type\":\"boolean\",\"default\":false,\"description\":\"Enable test mode for development\"}},\"required\":[\"merchantId\",\"apiKey\"]}",
"enabled": true,
"accessControl": {
"read": true,
"modify": false
}
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.upstartcommerce.com/v1/tenants/cfg/templates", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.upstartcommerce.com/v1/tenants/cfg/templates")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "text/plain"
request["content-type"] = "application/json"
request["x-upstart-tenant"] = "string"
request.body = JSON.dump({
"name": "Cybersource Payment Gateway Configuration",
"propertiesDec": "{\"type\":\"object\",\"properties\":{\"merchantId\":{\"type\":\"string\",\"description\":\"Merchant identifier from Cybersource\",\"pattern\":\"^[a-zA-Z0-9_-]+$\"},\"apiKey\":{\"type\":\"string\",\"description\":\"API key for authentication\",\"format\":\"password\",\"minLength\":32},\"apiUrl\":{\"type\":\"string\",\"format\":\"uri\",\"default\":\"https://api.cybersource.com\",\"description\":\"Cybersource API base URL\"},\"currency\":{\"type\":\"string\",\"enum\":[\"USD\",\"EUR\",\"GBP\"],\"default\":\"USD\",\"description\":\"Default currency for transactions\"},\"testMode\":{\"type\":\"boolean\",\"default\":false,\"description\":\"Enable test mode for development\"}},\"required\":[\"merchantId\",\"apiKey\"]}",
"enabled": true,
"accessControl": {
"read": true,
"modify": false
}
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.upstartcommerce.com/v1/tenants/cfg/templates"
payload = json.dumps({
"name": "Cybersource Payment Gateway Configuration",
"propertiesDec": "{\"type\":\"object\",\"properties\":{\"merchantId\":{\"type\":\"string\",\"description\":\"Merchant identifier from Cybersource\",\"pattern\":\"^[a-zA-Z0-9_-]+$\"},\"apiKey\":{\"type\":\"string\",\"description\":\"API key for authentication\",\"format\":\"password\",\"minLength\":32},\"apiUrl\":{\"type\":\"string\",\"format\":\"uri\",\"default\":\"https://api.cybersource.com\",\"description\":\"Cybersource API base URL\"},\"currency\":{\"type\":\"string\",\"enum\":[\"USD\",\"EUR\",\"GBP\"],\"default\":\"USD\",\"description\":\"Default currency for transactions\"},\"testMode\":{\"type\":\"boolean\",\"default\":false,\"description\":\"Enable test mode for development\"}},\"required\":[\"merchantId\",\"apiKey\"]}",
"enabled": True,
"accessControl": {
"read": True,
"modify": False
}
})
headers = {
'accept': 'text/plain',
'content-type': 'application/json',
'x-upstart-tenant': 'string'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Success-template created successfully. Returns the generated template ID.
400
// The request contained information that the server was unable to process. Appropriate errors are provided in the response body.
{
"name": "ValidationError",
"code": "SCHEMA_VALIDATION_FAILED",
"detail": "Configuration data validation failed: data.apiKey is required but was not provided. Expected string with minimum length 32."
}401
// The provided credentials were not valid for this endpoint. It may be that they are expired or that the user's roles are insufficient.
{
"name": "ResourceNotFoundError",
"code": "TEMPLATE_NOT_FOUND",
"detail": "The configuration template with ID \"payment-stripe\" was not found in the system.",
"reason": "The template may have been deleted or you may not have permission to access it. Verify the template ID using GET /tenants/cfg/templates."
}409
// The request conflicts with the current state of the resource. This typically occurs when trying to create a resource that already exists or when there's a conflict with business rules.
{
"name": "ResourceNotFoundError",
"code": "TEMPLATE_NOT_FOUND",
"detail": "The configuration template with ID \"payment-stripe\" was not found in the system.",
"reason": "The template may have been deleted or you may not have permission to access it. Verify the template ID using GET /tenants/cfg/templates."
}422
// The request was well-formed but contains semantic errors or violates business rules that prevent processing.
{
"name": "ResourceNotFoundError",
"code": "TEMPLATE_NOT_FOUND",
"detail": "The configuration template with ID \"payment-stripe\" was not found in the system.",
"reason": "The template may have been deleted or you may not have permission to access it. Verify the template ID using GET /tenants/cfg/templates."
}500
// An unexpected internal server error occurred. The request may be retried, and if the problem persists, contact support with the traceId from the error response.
{
"name": "ResourceNotFoundError",
"code": "TEMPLATE_NOT_FOUND",
"detail": "The configuration template with ID \"payment-stripe\" was not found in the system.",
"reason": "The template may have been deleted or you may not have permission to access it. Verify the template ID using GET /tenants/cfg/templates."
}