Create Service
POST
/api/v1/sectors/{sectorID}/services
const url = 'https://api.spartanauth.com/api/v1/sectors/example/services';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"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://api.spartanauth.com/api/v1/sectors/example/services \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'Creates a named service in a sector and returns its secret exactly once. The secret can mint short-lived tokens so that service can call another service in the same app sector. It cannot administer SpartanAuth. Requires sector-admin or tenant-root admin access.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” sectorID
required
string
Request Body
Section titled “Request Body ” Media type application/json
object
name
string
Example generated
{ "name": "example"}Responses
Section titled “ Responses ”A successful response.
Media type application/json
object
secret
plaintext secret — shown only once
string
service
Service is one of the customer’s own programs. Its secret mints short-lived tokens for calls to other programs in the same app sector.
object
id
string
name
string
sectorID
string
prefix
string
createdAt
string format: int64
lastExchangedAt
string format: int64
Example generated
{ "secret": "example", "service": { "id": "example", "name": "example", "sectorID": "example", "prefix": "example", "createdAt": "example", "lastExchangedAt": "example" }}default
Section titled “default ”An unexpected error response.
Media type application/json
object
code
integer format: int32
message
string
details
Array<object>
object
@type
string
key
additional properties
Example generated
{ "code": 1, "message": "example", "details": [ { "@type": "example" } ]}