# Get Started

To create a new service, you need to make following API calls:

1. Get a list of available topologies:

   ```
    curl --request GET 'https://api.skysql.com/provisioning/v1/topologies?service_type=transactional' \\
    --header "X-API-Key: $API_KEY"
   ```

   Example response:

   ```
   [
       {
           "id": "b34aa182-4c05-462f-8d4e-33a98de60803",
           "name": "standalone",
           "display_name": "Single Node Transactions",
           "service_type": "transactional",
           "storage_engine": "innodb",
           "order": 100
       }
   ]
   ```
2. Get a list of available providers:

   ```
   curl --request GET 'https://api.skysql.com/provisioning/v1/providers' \\
    --header "X-API-Key: $API_KEY"
   ```

   Example response:

   ```
   [
       {
           "id": "5a9c1675-ca54-4b3b-9da9-2ea617e45969",
           "name": "aws",
           "display_name": "Amazon AWS",
           "volume_size_min_gb": 8,
           "volume_size_max_gb": 2000,
           "iops_per_gb": 1,
           "iops_min": 100
       }
   ]
   ```
3. Get a list of available regions:

   ```
   curl --request GET 'https://api.skysql.com/provisioning/v1/regions?provider=aws' \\
   --header "X-API-Key: $API_KEY"
   ```

   Example response:

   ```
   [
       {
           "id": "eb5b9a88-cc6c-4c12-9306-44486b335357",
           "name": "eu-north-1",
           "region": "EMEA",
           "default": false,
           "provider": "aws",
           "foundation_tier_maintenance_window": "1st and 3rd Sat 8:00 PM UTC"
       }
   ]
   ```
4. Get a list of available instance sizes:

   ```
   curl --request GET 'https://api.skysql.com/provisioning/v1/sizes?topology=standalone&provider=aws&architecture=amd64' \\
   --header "X-API-Key: $API_KEY"
   ```

   Example response:

   ```
   [
       {
           "id": "c0666e11-4a3b-11ed-8853-b278760e6ab5",
           "name": "sky-2x4",
           "display_name": "Sky-2x4",
           "service_type": "transactional",
           "provider": "aws",
           "tier": "foundation",
           "architecture": "amd64",
           "cpu": "2 vCPU",
           "ram": "4 GB",
           "updated_on": "2022-10-12T14:40:00Z",
           "created_on": "2022-10-12T14:40:00Z",
           "is_active": true,
           "topology": "standalone"
       }
   ]
   ```
5. Get a list of available versions:

   ```
   curl --request GET 'https://api.skysql.com/provisioning/v1/versions?topology=standalone' \\
   --header "X-API-Key: $API_KEY"
   ```

   Example response:

   ```
   [
       {
           "id": "d4dd2755-5716-4be5-8e9c-b1437f0d109a",
           "name": "10.6.11-6-1",
           "version": "10.6.11-6",
           "topology": "standalone",
           "product": "server",
           "display_name": "Enterprise Server 10.6.11-6",
           "is_major": true,
           "release_date": "0001-01-01T00:00:00Z",
           "release_notes_url": "https://mariadb.com/docs/release-notes/mariadb-enterprise-server-10-6/10-6-11-6/"
       }
   ]
   ```

   *Important:* Use `name` field from the response to create a service. `version` and `display_name` fields are for display purposes only.
6. Create a new service:

   ```
   curl --request POST 'https://api.skysql.com/provisioning/v1/services' \\
   --header "X-API-Key: $API_KEY" \\
   --header "Content-Type: application/json" \\
   --data-raw '{
       "service_type": "transactional",
       "topology": "standalone",
       "provider": "aws",
       "region": "us-east-2",
       "name": "my-first-service",
       "architecture": "amd64",
       "nodes": 1,
       "size": "sky-2x8",
       "storage": 100,
       "ssl_enabled": true,
       "version": "10.6.11-6-1",
       "volume_type": "gp2"
   }'
   ```

   The operation is asynchronous. You need to poll the service status until it has status `ready` or `failed`. If you need to create a new service with access through a private link you need to pass the following parameters:

   ```
       "endpoint_mechanism": "privateconnect",
       "endpoint_allowed_accounts": [
       "[AWS account ID or GCP project ID]"
       ]
   ```
7. Get a service by ID to check status:

   ```
   curl --request GET 'https://api.skysql.com/provisioning/v1/services/dbdwf40820593' \\
   --header "X-API-Key: $API_KEY"
   ```

   Example response:

   ```
   {
       "id": "dbdwf40820593",
       "name": "my-first-service",
       "status": "ready",
   }
   ```
8. Get service default credentials:

   ```
   curl --request GET 'https://api.skysql.com/provisioning/v1/services/dbdwf40820593/security/credentials' \\
   --header "X-API-Key: $API_KEY"
   ```
9. Add your IP address to the IP allowlist for the service

   If you are not sure of your public IP address, you can use a lookup service, such as checkip.amazonaws.com

   The allowlist accepts IPv4 addresses and IPv4 netblocks.

   We will place our IP address in the SKYSQL\_CLIENT\_IP environment variable:

   ```
   export SKYSQL_CLIENT_IP=`curl -sS checkip.amazonaws.com`
   ```

   add our IP address to the allowlist:

   ```
   curl -sS --location --request POST \\
   --header "X-API-Key: $API_KEY" \\
   --header "Accept: application/json" \\
   --header "Content-type: application/json" \\
   --data "{ \"ip_address\": \"${SKYSQL_CLIENT_IP}/32\" }" \\
   https://api.skysql.com/provisioning/v1/services/${SKYSQL_SERVICE}/security/allowlist \\
   | jq .
   ```
10. Stop a service:

    ```
    curl --request POST 'https://api.skysql.com/provisioning/v1/services/dbdwf40820593/power' \\
    --header "X-API-Key: $API_KEY" \\
    --header "Content-Type: application/json" \\
    --data-raw '{
        "is_active": false
    }'
    ```
11. Start a service:

    ```
    curl --request POST 'https://api.skysql.com/provisioning/v1/services/dbdwf40820593/power' \\
    --header "X-API-Key: $API_KEY" \\
    --header "Content-Type: application/json" \\
    --data-raw '{
        "is_active": true
    }'
    ```
12. Change storage size:

    ```
    curl --request PATCH 'https://api.skysql.com/provisioning/v1/services/dbdwf40820593/storage/size' \\
    --header "X-API-Key: $API_KEY" \\
    --header "Content-Type: application/json" \\
    --data-raw '{
        "size": 200
    }'
    ```
13. Delete service

    ```
    curl --request DELETE 'https://api.skysql.com/provisioning/v1/services/dbdwf40820593' \\
    --header "X-API-Key: $API_KEY"
    ```


---

# 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://mariadb.com/docs/mariadb-cloud/reference/mariadb-cloud-api-reference-guide/get-started.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.
