> For the complete documentation index, see [llms.txt](https://docs.osmosworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.osmosworks.com/api-reference/tenant-services.md).

# Tenant services

Base path: `/api/v1/tenant/services`

All endpoints require authentication. Read endpoints require `service.read`; write endpoints require `service.update` or `service.create`.

## List services

* **Method:** `GET`
* **Path:** `/api/v1/tenant/services?search={search}&state={state}&page=0&size=20&sort=createdAt,desc`
* **Permission:** `service.read`

`state` can filter by published, archived, or draft status depending on the implementation.

## Get a service

* **Method:** `GET`
* **Path:** `/api/v1/tenant/services/{id}`
* **Permission:** `service.read`

## Create a service

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services`
* **Permission:** `service.create`

### Request body

```json
{
  "name": "Family Visa Assistance",
  "currency": "NGN",
  "partyRole": "Traveller",
  "description": "End-to-end family visa processing",
  "hint": "Use for immediate family only",
  "minParties": 1,
  "maxParties": 6
}
```

### Response

```json
{
  "status": "Success",
  "message": "Service created successfully.",
  "data": {
    "id": "c3d4e5f6-...",
    "code": "OSM-SD-XXXXXX",
    "name": "Family Visa Assistance",
    "currency": "NGN",
    "status": "ACTIVE",
    "published": false,
    "archived": false
  }
}
```

## Update a service

* **Method:** `PATCH`
* **Path:** `/api/v1/tenant/services/{serviceId}`
* **Permission:** `service.update`

```json
{
  "name": "Family Visa Assistance - Premium",
  "description": "Updated description"
}
```

## Publish a service

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/publish`
* **Permission:** `service.update`

Requires every ordinary stage to have at least one question and every payment stage to have at least one charge.

## Archive a service

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/archive`
* **Permission:** `service.update`

## Restore a service

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/restore`
* **Permission:** `service.update`

## Preview a service

Returns the service as a customer would see it, with optional sample answers.

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{id}/preview`
* **Permission:** `service.read`

## Service templates

### List templates

* **Method:** `GET`
* **Path:** `/api/v1/tenant/services/templates?sector=immigration`
* **Permission:** `service.read`

### Create from template

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/templates/{templateCode}`
* **Permission:** `service.create`

## Stages

### List stages

* **Method:** `GET`
* **Path:** `/api/v1/tenant/services/{serviceId}/stages`
* **Permission:** `service.read`

### Get a stage

* **Method:** `GET`
* **Path:** `/api/v1/tenant/services/{serviceId}/stages/{stageId}`
* **Permission:** `service.read`

### Create a stage

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/stages`
* **Permission:** `service.update`

```json
{
  "title": "Traveler Details",
  "description": "Basic traveler information",
  "kind": "ORDINARY",
  "position": 1,
  "showRule": null
}
```

### Update a stage

* **Method:** `PATCH`
* **Path:** `/api/v1/tenant/services/{serviceId}/stages/{stageId}`
* **Permission:** `service.update`

### Delete a stage

* **Method:** `DELETE`
* **Path:** `/api/v1/tenant/services/{serviceId}/stages/{stageId}`
* **Permission:** `service.update`

A stage cannot be deleted if it still contains questions, charges, or documents.

## Questions

### Create a question

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/questions`
* **Permission:** `service.update`

```json
{
  "stageId": "d4e5f6a7-...",
  "code": "nationality",
  "label": "What is the traveller's nationality?",
  "answerType": "SINGLE_CHOICE",
  "appliesTo": "PARTY",
  "required": true,
  "position": 1,
  "options": [
    { "label": "Nigeria", "value": "Nigeria", "active": true },
    { "label": "Ghana", "value": "Ghana", "active": true }
  ]
}
```

### Update a question

* **Method:** `PATCH`
* **Path:** `/api/v1/tenant/services/{serviceId}/questions/{questionId}`
* **Permission:** `service.update`

### Delete a question

* **Method:** `DELETE`
* **Path:** `/api/v1/tenant/services/{serviceId}/questions/{questionId}`
* **Permission:** `service.update`

A question cannot be deleted if it is referenced by rules.

## Requirements (documents)

### Create a requirement

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/documents`
* **Permission:** `service.update`

```json
{
  "stageId": "d4e5f6a7-...",
  "code": "passport_copy",
  "name": "Passport copy",
  "instructions": "Upload a clear scan of the passport data page.",
  "appliesTo": "PARTY",
  "required": true,
  "reviewRequired": true,
  "position": 1
}
```

### Update a requirement

* **Method:** `PATCH`
* **Path:** `/api/v1/tenant/services/{serviceId}/documents/{documentId}`
* **Permission:** `service.update`

### Delete a requirement

* **Method:** `DELETE`
* **Path:** `/api/v1/tenant/services/{serviceId}/documents/{documentId}`
* **Permission:** `service.update`

## Charges

### Create a charge

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/charges`
* **Permission:** `service.update`

```json
{
  "stageId": "d4e5f6a7-...",
  "name": "Base application fee",
  "basis": "PER_PARTY",
  "amount": 50000,
  "position": 1
}
```

### Update a charge

* **Method:** `PATCH`
* **Path:** `/api/v1/tenant/services/{serviceId}/charges/{chargeId}`
* **Permission:** `service.update`

### Delete a charge

* **Method:** `DELETE`
* **Path:** `/api/v1/tenant/services/{serviceId}/charges/{chargeId}`
* **Permission:** `service.update`

## Value sets

### Create a value set

* **Method:** `POST`
* **Path:** `/api/v1/tenant/services/{serviceId}/value-sets`
* **Permission:** `service.update`

```json
{
  "code": "ECOWAS",
  "name": "ECOWAS member states",
  "members": ["Nigeria", "Ghana", "Senegal", "Côte d'Ivoire"]
}
```

### Update a value set

* **Method:** `PATCH`
* **Path:** `/api/v1/tenant/services/{serviceId}/value-sets/{valueSetId}`
* **Permission:** `service.update`

### Delete a value set

* **Method:** `DELETE`
* **Path:** `/api/v1/tenant/services/{serviceId}/value-sets/{valueSetId}`
* **Permission:** `service.update`

A value set cannot be deleted if it is referenced by a rule.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.osmosworks.com/api-reference/tenant-services.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
