Schema Management API Reference

Overview

The Schema Management APIs provide programmatic access to create, modify, and delete database objects such as databases, tables, indexes, constraints, views, and stored procedures. Use these APIs to automate deployment, migration, and version control of your database schema.

All calls are available via RESTful endpoints and support JSON payloads.

Getting Started

To begin using the Schema Management APIs, obtain an access token and include it in the Authorization header of each request.

{
    "Authorization": "Bearer <your-token>"
}

Base URL for all Schema Management endpoints:

https://api.microsoft.com/sql/v1/schema

Key Endpoints

  • Create Database: POST /databasesDetails
  • Alter Table: PATCH /tables/{tableId}Details
  • Drop Index: DELETE /indexes/{indexId}Details
  • Create View: POST /viewsDetails

Sample Request

{
  "name": "Products",
  "columns": [
    {"name":"ProductID","type":"int","primaryKey":true},
    {"name":"ProductName","type":"nvarchar(100)"},
    {"name":"Price","type":"decimal(10,2)"}
  ]
}

POST this JSON to /tables to create a new table.