Skip to content

Create Service

POST
/api/v1/sectors/{sectorID}/services
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.

sectorID
required
string
Media type application/json
object
name
string
Example generated
{
"name": "example"
}

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"
}
}

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"
}
]
}