Scalingo API Documentation

website·Indexed 35 days ago

https://developers.scalingo.com/

Developer documentation for the Scalingo API V1 and Database API. Includes endpoints for managing applications, projects, containers, environment variables, and deployments. Covers database operations such as Point-in-Time Restoration, backups, and instance status, as well as SCM integrations, log drains, and addon provider manifests.

Tokens
49.7K
Snippets
331
Records
374
Agent score
60%

What's inside Scalingo

  1. Overview of Dedicated Resource Databases

    Dedicated Resource databases provide enhanced performance, isolation, and control compared to standard addon databases. These endpoints are specifically for managing databases provisioned as Dedicated Resources. Standard addon databases (including MySQL, MongoDB, and Redis) must be managed via the Addons endpoints.
  2. Overview of Scalingo SSH Keys

    SSH keys in Scalingo are used to deploy applications and establish encrypted tunnels to application databases (via the db-tunnel command in the Scalingo CLI Tool). Each SSH key object consists of a unique id, a descriptive name, and the raw content of the public key.
  3. Overview of SCM Integrations

    SCM Integrations link a Scalingo account to an SCM platform. Supported platforms include GitHub, GitLab, GitHub Enterprise, and GitLab self-hosted.

    Important Constraints:

    • github and gitlab (cloud) integrations must be created via the OAuth system on the Dashboard profile page.
    • Only github-enterprise and gitlab-self-hosted integrations can be created via the API.
  4. Manage application source archives via the Sources API

    Sources in Scalingo provide temporary upload and download locations for tarballs. These are typically used to provide the code for an application during a deployment. Source URLs are short-lived (expiring after 10 minutes), and uploaded files are automatically deleted from the storage backend once the links expire.
  5. Parse Review App creation events

    When a Review App is created, an event with type=create_review_app is generated. The type_data object includes the Review App's name and dashboard URL, as well as details about the originating Pull/Merge Request (name, number, URL, and whether it came from a fork).
    {
      "id": "54dcdd4a73636100011a0000",
      "created_at": "2020-09-22T09:00:00.000Z",
      "user": {
        "username": "johndoe",
        "email": "john@doe.com",
        "id": "us-0e6d8e46-5cd0-42a4-acba-372b2be605ac"
      },
      "app_id": "5343eccd646173000a140000",
      "app_name": "sample-go-martini",
      "type": "create_review_app",
      "type_data": {
        "review_app_name": "sample-go-martini-pr2",
        "review_app_url": "https://dashboard.scalingo.com/sample-go-martini-pr2",
        "source_repo_name": "johndoe/sample-go-martini",
        "source_repo_url": "https://github.com/johndoe/sample-go-martini",
        "pr_name": "Update the name",
        "pr_number": 3,
        "pr_url": "https://github.com/johndoe/sample-go-martini/pull/3",
        "pr_comes_from_a_fork": false
      }
    }
  6. Understand Scalingo Event Types

    Event types define the specific events published by the Scalingo service. These definitions are primarily used by Notification Platforms and Notifiers to determine which types of events should be sent to configured destinations. Each event type contains the following attributes:

    • id (string): Unique ID of the event type.
    • category_id (string): The ID of the category the event type belongs to.
    • name (string): The camel case name of the type (e.g., app_deployed).
    • display_name (string): A human-readable name for the type.
    • description (string): A description of when these events are produced.
  7. Manage Scalingo application environment variables

    Scalingo provides an API to manage environment variables for applications. Note that creating, updating, or deleting an environment variable does not automatically restart the application; you must manually trigger a restart using the 'restart application' endpoint for changes to take effect.

    Environment Variable Constraints:

    • Name limit: 64 characters
    • Value limit: 8192 characters

    Variable Object Schema:

    • id (string): Unique ID of the variable
    • name (string): Name of the variable
    • value (string): Value of the variable
  8. Retrieve database information

    Retrieve detailed information about a specific database using its database ID. To find the database ID, refer to the addon API documentation; the ID corresponds to the addon's id field.
    curl -H "Accept: application/json" -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DB_BEARER_TOKEN" \
      -X GET https://$DB_API_URL/api/databases/my-db-123
  9. Retrieve project transfer invitation details

    When retrieving a project transfer invitation via the Scalingo API, the response contains a transfer_invitation object. This object provides details about the ownership transfer request, including the unique invitation ID, the project being transferred, the IDs and names of both the inviter and the invited user, the current status of the invitation (e.g., 'canceled'), and timestamps for creation, update, and expiration.
    {
      "transfer_invitation": {
        "id": "tin-01234567-89ab-cdef-0123-456789abcdef",
        "project_id": "pr-82a3cac5-9b25-473e-b33d-6272b87e636f",
        "invited_user_id": "us-f456a6c1-54d8-4a32-9d61-5f3c8e9d016a",
        "invited_user_name": "alice",
        "inviter_user_id": "us-c1a410ff-d68f-4c94-9a83-c3dedf866d63",
        "status": "canceled",
        "status_reason": "",
        "expires_at": "2014-09-13T10:17:52.690+02:00",
        "created_at": "2014-09-10T10:17:52.690+02:00",
        "updated_at": "2014-09-10T11:00:00.000+02:00"
      }
    }
  10. Scalingo API V1 Overview

    The Scalingo V1 API allows developers to control the cloud computing platform. All endpoints are prefixed with /v1 and require HTTPS. The API is 'REST-ish' and uses JSON for data exchange. The base URL is https://$SCALINGO_API_URL/v1/.
  11. Retrieve database instance status

    Use the instances_status endpoint to get detailed information about the instances of a specific database. This includes the instance ID, type, current operational status, and its role within the cluster.

    Instance Types:

    • db-node: A standard database node.
    • gateway: A gateway instance.
    • utility: A utility service (e.g., Redis Sentinel).

    Possible Statuses:

    • running: The instance is functional.
    • Other states include: booting, restarting, migrating, upgrading, stopped, or removing.

    Cluster Roles (for db-nodes):

    • leader: The primary node.
    • follower: A replica node.
    curl -H "Accept: application/json" \
      -H "Authorization: Bearer $DB_BEARER_TOKEN" \
      -X GET https://$DB_API_URL/api/databases/my-awesome-db-1234/instances_status
  12. Parse SCM integration update events

    When an SCM integration link is created or updated for an app, an event with type=update_scm is generated. The type_data object contains details about the repository, branch, and auto-deployment settings, including Review App lifecycle configurations.
    {
      "id": "54dcdd4a73636100011a0000",
      "created_at": "2020-09-22T09:00:00.000Z",
      "user": {
        "username": "johndoe",
        "email": "john@doe.com",
        "id": "us-0e6d8e46-5cd0-42a4-acba-372b2be605ac"
      },
      "app_id": "5343eccd646173000a140000",
      "app_name": "appname",
      "type": "update_scm",
      "type_data": {
        "repo_name": "johndoe/sample-go-martini",
        "linker_username": "johndoe",
        "source": "https://github.com/johndoe/sample-go-martini",
        "branch": "main",
        "auto_deploy": true,
        "auto_deploy_review_apps": true,
        "delete_on_close": true,
        "delete_stale": true,
        "hours_before_delete_on_close": 5,
        "hours_before_delete_stale": 0,
        "creation_from_forks_allowed": false
      }
    }