Getting started
Back to home
Getting started

Delete a database

Request deletion of the database and its data. This requires the separate database-deletion permission. Nothing is deleted when the request is refused with HTTP 409: workload_busy while a restore or import runs on the database, project_deleting while its project is being deleted (that delete removes it).

DELETE/api/customer/v1/projects/{projectId}/databases/{databaseId}

This operation can remove, overwrite or interrupt resources, or grant access. Check the project and resource IDs before sending it.

Send an Idempotency-Key header. Keep the same value when retrying this exact request. A different payload needs a new key.

Path parameters

NameValue
projectIdRequired resource ID from an earlier API response.
databaseIdRequired resource ID from an earlier API response.

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

Set REQUEST_ID to a unique value for this request.

curl --request DELETE "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/databases/${DATABASE_ID}" \
  --header "Authorization: Bearer $HCODE_API_KEY" \
  --header "Idempotency-Key: $REQUEST_ID"

Response

The JSON shape is defined in the response schema.

Queued work returns HTTP 202 with an operation handle. Poll that handle to find out whether the work succeeded.

Response schema
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "message": {
      "type": "string"
    },
    "operationId": {
      "type": "string"
    },
    "operation": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "operationId": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "errorMessage": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "createdAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "startedAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "finishedAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "status"
      ],
      "additionalProperties": true
    },
    "deploymentId": {
      "type": "string"
    },
    "projectId": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "href": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "href"
        ]
      }
    }
  },
  "required": [],
  "additionalProperties": true
}

See errors and retries for failure responses.