Files
supabase/apps/reference/_api/usage.mdx
2022-08-14 15:27:03 +02:00

1369 lines
22 KiB
Plaintext

---
id: usage
slug: /usage
title: Usage
toc_max_heading_level: 3
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## List all projects {#list-all-projects}
```
GET https://api.supabase.com/v1/projects
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"organization_id": {
"type": "string"
},
"name": {
"type": "string"
},
"region": {
"type": "string"
},
"created_at": {
"type": "string"
}
},
"required": [
"id",
"organization_id",
"name",
"region",
"created_at"
]
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Create a project {#create-a-project}
```
POST https://api.supabase.com/v1/projects
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Body
```json
{
"schema": {
"type": "object",
"properties": {
"db_pass": {
"type": "string"
},
"name": {
"type": "string"
},
"organization_id": {
"type": "string"
},
"plan": {
"type": "string",
"enum": [
"free",
"pro"
]
},
"region": {
"type": "string",
"enum": [
"us-east-1",
"us-west-1",
"ap-southeast-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-southeast-2",
"eu-west-1",
"eu-west-2",
"eu-central-1",
"ca-central-1",
"ap-south-1",
"sa-east-1"
]
}
},
"required": [
"db_pass",
"name",
"organization_id",
"plan",
"region"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="201">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"organization_id": {
"type": "string"
},
"name": {
"type": "string"
},
"region": {
"type": "string"
},
"created_at": {
"type": "string"
}
},
"required": [
"id",
"organization_id",
"name",
"region",
"created_at"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## List all organizations {#list-all-organizations}
```
GET https://api.supabase.com/v1/organizations
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
]
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Unexpected error listing organizations
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Create an organization {#create-an-organization}
```
POST https://api.supabase.com/v1/organizations
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Body
```json
{
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="201">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Unexpected error creating an organization
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## List all functions {#list-all-functions}
```
GET https://api.supabase.com/v1/projects/{ref}/functions
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"slug": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"enum": [
"ACTIVE",
"REMOVED",
"THROTTLED"
],
"type": "string"
},
"version": {
"type": "number"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"verify_jwt": {
"type": "boolean"
}
},
"required": [
"id",
"slug",
"name",
"status",
"version",
"created_at",
"updated_at"
]
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to retrieve project's functions
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Create a function {#create-a-function}
```
POST https://api.supabase.com/v1/projects/{ref}/functions
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Body
```json
{
"schema": {
"type": "object",
"properties": {
"slug": {
"type": "string",
"pattern": {}
},
"name": {
"type": "string"
},
"body": {
"type": "string"
},
"verify_jwt": {
"type": "boolean"
}
},
"required": [
"slug",
"name",
"body"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="201">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"slug": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"enum": [
"ACTIVE",
"REMOVED",
"THROTTLED"
],
"type": "string"
},
"version": {
"type": "number"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"verify_jwt": {
"type": "boolean"
}
},
"required": [
"id",
"slug",
"name",
"status",
"version",
"created_at",
"updated_at"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to create project's function
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Retrieve a function {#retrieve-a-function}
```
GET https://api.supabase.com/v1/projects/{ref}/functions/{function_slug}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
include_body
</span>
<span className="method-list-item-label-badge">
optional
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
function_slug
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Function slug
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"slug": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"enum": [
"ACTIVE",
"REMOVED",
"THROTTLED"
],
"type": "string"
},
"version": {
"type": "number"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"verify_jwt": {
"type": "boolean"
},
"body": {
"type": "string"
}
},
"required": [
"id",
"slug",
"name",
"status",
"version",
"created_at",
"updated_at"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to retrieve function with given slug
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Update a function {#update-a-function}
```
PATCH https://api.supabase.com/v1/projects/{ref}/functions/{function_slug}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
function_slug
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Function slug
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Body
```json
{
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"body": {
"type": "string"
},
"verify_jwt": {
"type": "boolean"
}
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"slug": {
"type": "string"
},
"name": {
"type": "string"
},
"status": {
"enum": [
"ACTIVE",
"REMOVED",
"THROTTLED"
],
"type": "string"
},
"version": {
"type": "number"
},
"created_at": {
"type": "number"
},
"updated_at": {
"type": "number"
},
"verify_jwt": {
"type": "boolean"
}
},
"required": [
"id",
"slug",
"name",
"status",
"version",
"created_at",
"updated_at"
]
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to update function with given slug
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Delete a function {#delete-a-function}
```
DELETE https://api.supabase.com/v1/projects/{ref}/functions/{function_slug}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
function_slug
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Function slug
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to delete function with given slug
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## List all secrets {#list-all-secrets}
```
GET https://api.supabase.com/v1/projects/{ref}/secrets
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"name",
"value"
]
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to retrieve project's secrets
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Bulk create secrets {#bulk-create-secrets}
```
POST https://api.supabase.com/v1/projects/{ref}/secrets
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Body
```json
{
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string",
"pattern": {}
}
},
"required": [
"name",
"value"
]
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="201">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to create project's secrets
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
## Bulk delete secrets {#bulk-delete-secrets}
```
DELETE https://api.supabase.com/v1/projects/{ref}/secrets
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Parameters
<ul className="method-list-group">
<li className="method-list-item">
<h4 className="method-list-item-label">
<span className="method-list-item-label-name">
ref
</span>
<span className="method-list-item-label-badge">
required
</span>
<span className="method-list-item-validation">
</span>
</h4>
<div class="method-list-item-description">
Project ref
</div>
</li>
</ul>
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Body
```json
{
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
### Responses
<Tabs>
<TabItem value="200">
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
```json
{
"schema": {
"type": "object"
}
}
```
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
<TabItem value="500">
Failed to delete secrets with given names
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
</TabItem>
</Tabs>
<br />