# Self-Service Actions

## Self-Service Action Descriptor

Regardless of whether you're using UI editing or GitOps to manage your self-service actions, the definitions are backed by JSON files. Each file is a fully compliant OpenAPI 3 spec file, with our own specific extensions.

{% hint style="info" %}
**You can still use Self Service Actions even if you don't use OpenAPI/Swagger.**

We use the OpenAPI spec as a base for automation rule configuration, since it's an open spec with official support for extensions. That lets us extend it to be an automation rule descriptor spec with optional usage of actual OpenAPI fields.
{% endhint %}

All automation rule descriptors have 5 metadata fields:

* **ID**: A unique identifier for the rule.
* **Name**: A user-friendly display name.
* **Description** (Optional): A concise overview of the action for further context.
* **Is Active**: Boolean parameter that determines whether the self-service-action is active and should be executed or not.
* **Type:** Defines the type of rule (`selfServiceAction`) .

### Triggers

Triggers are conditions that initiate the execution. For self-service actions, the only available trigger type is `manual` meaning users need to manual execute the action either via the UI or API.

The trigger sections also specify the arguments (and their data-types) that a self-service action requires to be triggered, which are used as input when triggering an action from the UI.

E.g.

```json
"triggers": [
   {
      "type":"manual",
      "inputSchema":{
         "type":"object",
         "title":"Repository Details",
         "required":[
            "repositoryName",
            "visibility"
         ],
         "properties":{
            "repositoryName":{
               "type":"string",
               "title":"Repository Name",
               "description": "The name of the Repository in Gitlab"
            },
            "visibility":{
               "type":"string",
               "title":"Visibility",
               "description": "The visibility of the Repository ('hidden', 'internal', 'public')",
               "enum": ["private", "internal", "public"],
               "default":"hidden"
            }
         }
      }
   }
]
```

### Actions

Actions are the operations executed by the automation rule when a trigger condition is met. Actions in self-service action rules resemble the schema and syntax of [actions in automation rules](/basic-concepts/actions-and-automations/automation-rules.md#actions).

### Data Manipulation

Data Manipulation in self-service action rules resemble the behaviour of actions in [automation rules](/basic-concepts/actions-and-automations/automation-rules.md#data-manipulation).

### Example 1 (Creating a Gitlab Repository)

```json
{
	"id": "gitlab-repo-creation",
	"title": "Create Repository in GitLab",
	"description": "Create a new GitLab repository",
	"isActive": true,
	"order": 0,
	"type": "selfServiceAction",
	"arguments": {},
	"triggers": [
   {
      "type":"manual",
      "inputSchema":{
         "type":"object",
         "title":"Repository Details",
         "required":[
            "repositoryName",
            "visibility"
         ],
         "properties":{
            "repositoryName":{
               "type":"string",
               "title":"Repository Name",
               "description": "The name of the Repository in Gitlab"
            },
            "visibility":{
               "type":"string",
               "title":"Visibility",
               "description": "The visibility of the Repository ('hidden', 'internal', 'public')",
               "enum": ["private", "internal", "public"],
               "default":"hidden"
            }
         }
      }
	}],
	"actions": [{
	   "type": "httpRequest",
	   "args": {
		   "body": "{\"name\": \"{{ data.repositoryName }}\", \"visibility\": \"{{ data.visibility }}\"}",
		   "path": "",
		   "method": "post",
		   "baseUrl": "https://gitlab.com/api/v4/projects",
		   "headers": {
			   "Content-Type": "application/json",
			   "PRIVATE-TOKEN": "{{ env('GITLAB_TOKEN_ID') }}"
		   }
	   }
        }],
	"tags": [{
      "key": "data-source",
      "value": "gitlab"
    }]
}
```

## Learn More

<table data-view="cards"><thead><tr><th>Self Service Actions</th></tr></thead><tbody><tr><td><a data-mention href="/pages/CtOCHn7fZFPU356TwTzd">/pages/CtOCHn7fZFPU356TwTzd</a></td></tr><tr><td><a data-mention href="/pages/xSOFxkqWT5zNP2uJcypV">/pages/xSOFxkqWT5zNP2uJcypV</a></td></tr><tr><td><a data-mention href="/pages/GBNtQcvE0HTeng4Lz04A">/pages/GBNtQcvE0HTeng4Lz04A</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rely.io/basic-concepts/actions-and-automations/self-service-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
