1.6 KiB
1.6 KiB
management-api
Use Prisma Management API for programmatic provisioning and workspace/project/database management.
Priority
CRITICAL
Why It Matters
When you need backend automation, multi-tenant onboarding flows, or controlled resource provisioning, the Management API is the source of truth and is more reliable than interactive workflows.
Base URL
https://api.prisma.io/v1
API exploration
- OpenAPI docs:
https://api.prisma.io/v1/doc - Swagger Editor:
https://api.prisma.io/v1/swagger-editor
Authentication methods
- Service token: best for server-to-server operations in your own workspace
- OAuth 2.0: best for acting on behalf of users across workspaces
Service token flow
- Create token in Prisma Console workspace settings.
- Send token as Bearer auth:
Authorization: Bearer $TOKEN
OAuth flow summary
- Redirect user to
https://auth.prisma.io/authorizewithclient_id,redirect_uri,response_type=code, and scopes. - Receive
codeon callback. - Exchange code at
https://auth.prisma.io/token. - Use returned access token in Management API requests.
Common endpoints
GET /workspacesGET /projectsPOST /projects- Database management endpoints under project/database paths
Notes
- Management API responses may include direct connection credentials for databases.
- Build PostgreSQL
DATABASE_URLfrom direct connection values when needed.