---
title: "Create a service"
method: POST
path: "/v1/{organization}/service/"
tags: ["Service"]
---

# Create a service

`POST /v1/{organization}/service/`

Create a new service. Depending on whether an active service with the same name already exists, the endpoint behaves differently:
* If `is_active` is `False`, creates an inactive new service.
* If `is_active` is `True` and no active service with the given name exists, creates a new active service.
* If `is_active` is `True` and an active service with the given name exists, this endpoint throws an error.

The new service will automatically contain an `edge` version set that uses the latest `Agent` and `ServiceHierarchicalStateMachine` versions with no LLM model preference.
It will also create a `release` version set, that will equal to what's specified in the request if the `release_version_set` is specified, or equal to `edge` if not.

#### Permissions
This endpoint requires the following permissions:
* `Service:CreateService` for the service to create.
* `Service:CreateVersionSet` for the `edge` and `release` version sets.

## Path parameters

- `organization` string, required

## Headers

- `x-mongo-cluster-name` string, nullable — The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
- `Sec-WebSocket-Protocol` string[]

## Request body

- SrcAppEndpointsServiceCreateServiceRequest
  - `service_hierarchical_state_machine_id` string, required — The ID of the state machine that this service uses.
  - `agent_id` string, required — The ID of the agent that this service uses.
  - `name` string, required
  - `description` string, required
  - `is_active` boolean, required — Whether the newly-created service is active. Only active services are visible to users on the dashboard. You can later adjust the activeness of this service.
  - `release_version_set` VersionSetInput
    - `agent_version_number` integer, nullable, required — The version number of the agent to be used. If None, the latest agent version will be used.
    - `service_hierarchical_state_machine_version_number` integer, nullable, required — The version number of the state machine to be used. If None, the latest state machine version will be used.
    - `llm_model_preferences` object, required
  - `keyterms` StrippedNonemptyStringAZAZ02[], required — A list of keyterms that are easy to get wrong during audio transcriptions that tend to occur commonly in audio sessions using this service.
  - `tags` object, required — The tags of this service.

## Response `201`

Succeeded.

- SrcAppEndpointsServiceCreateServiceResponse
  - `id` string, required — The ID of the newly created service.

## Other responses

- `400` — This error could be thrown due to the following reasons: * The specified ID for agent or service hierarchical state machine versions in the `release` version set does not belong to the agent or service hierarchical state machine of the service. * The specified agent or state machine doesn't have any versions. * The specified LLM config is invalid.
- `401` — Invalid authorization credentials.
- `403` — Missing required permissions.
- `404` — The specified organization, agent, or service hierarchical state machine do not exist.
- `409` — An active service with the given name already exists.
- `422` — Invalid request path parameter or request body failed validation.
- `429` — The user has exceeded the rate limit of 20 requests per minute for this endpoint.
- `503` — The service is going through temporary maintenance.

---

[API](https://skmtc.net/amigo/apis/amigo-api.md) · [All operations](https://skmtc.net/amigo/apis/amigo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/amigo/amigo-api/revisions/f0f28319e448/schema)
