cURL
if [ -z "$STABILITY_API_KEY" ]; then
echo "STABILITY_API_KEY environment variable is not set"
exit 1
fi
# Determine the URL to use for the request
BASE_URL=${API_HOST:-https://api.stability.ai}
URL="$BASE_URL/v1/user/account"
curl -f -sS "$URL" \
-H 'Accept: application/json' \
-H "Authorization: Bearer $STABILITY_API_KEY"import os
import requests
api_host = os.getenv('API_HOST', 'https://api.stability.ai')
url = f"{api_host}/v1/user/account"
api_key = os.getenv("STABILITY_API_KEY")
if api_key is None:
raise Exception("Missing Stability API key.")
response = requests.get(url, headers={
"Authorization": f"Bearer {api_key}"
})
if response.status_code != 200:
raise Exception("Non-200 response: " + str(response.text))
# Do something with the payload...
payload = response.json()
import fetch from 'node-fetch'
const apiHost = process.env.API_HOST ?? 'https://api.stability.ai'
const url = `${apiHost}/v1/user/account`
const apiKey = process.env.STABILITY_API_KEY
if (!apiKey) throw new Error('Missing Stability API key.')
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
if (!response.ok) {
throw new Error(`Non-200 response: ${await response.text()}`)
}
interface User {
id: string
profile_picture: string
email: string
organizations?: Array<{
id: string
name: string
role: string
is_default: boolean
}>
}
// Do something with the user...
const user = (await response.json()) as User
{
"email": "example@stability.ai",
"id": "user-1234",
"organizations": [
{
"id": "org-5678",
"name": "Another Organization",
"role": "MEMBER",
"is_default": true
},
{
"id": "org-1234",
"name": "My Organization",
"role": "MEMBER",
"is_default": false
}
],
"profile_picture": "https://api.stability.ai/example.png"
}{
"id": "9160aa70-222f-4a36-9eb7-475e2668362a",
"name": "unauthorized",
"message": "missing authorization header"
}{
"id": "f81964d6-619b-453e-97bc-9fd7ac3f04e7",
"name": "server_error",
"message": "An unexpected server error occurred, please try again."
}User
Account details
Get information about the account associated with the provided API key
GET
/
v1
/
user
/
account
cURL
if [ -z "$STABILITY_API_KEY" ]; then
echo "STABILITY_API_KEY environment variable is not set"
exit 1
fi
# Determine the URL to use for the request
BASE_URL=${API_HOST:-https://api.stability.ai}
URL="$BASE_URL/v1/user/account"
curl -f -sS "$URL" \
-H 'Accept: application/json' \
-H "Authorization: Bearer $STABILITY_API_KEY"import os
import requests
api_host = os.getenv('API_HOST', 'https://api.stability.ai')
url = f"{api_host}/v1/user/account"
api_key = os.getenv("STABILITY_API_KEY")
if api_key is None:
raise Exception("Missing Stability API key.")
response = requests.get(url, headers={
"Authorization": f"Bearer {api_key}"
})
if response.status_code != 200:
raise Exception("Non-200 response: " + str(response.text))
# Do something with the payload...
payload = response.json()
import fetch from 'node-fetch'
const apiHost = process.env.API_HOST ?? 'https://api.stability.ai'
const url = `${apiHost}/v1/user/account`
const apiKey = process.env.STABILITY_API_KEY
if (!apiKey) throw new Error('Missing Stability API key.')
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
if (!response.ok) {
throw new Error(`Non-200 response: ${await response.text()}`)
}
interface User {
id: string
profile_picture: string
email: string
organizations?: Array<{
id: string
name: string
role: string
is_default: boolean
}>
}
// Do something with the user...
const user = (await response.json()) as User
{
"email": "example@stability.ai",
"id": "user-1234",
"organizations": [
{
"id": "org-5678",
"name": "Another Organization",
"role": "MEMBER",
"is_default": true
},
{
"id": "org-1234",
"name": "My Organization",
"role": "MEMBER",
"is_default": false
}
],
"profile_picture": "https://api.stability.ai/example.png"
}{
"id": "9160aa70-222f-4a36-9eb7-475e2668362a",
"name": "unauthorized",
"message": "missing authorization header"
}{
"id": "f81964d6-619b-453e-97bc-9fd7ac3f04e7",
"name": "server_error",
"message": "An unexpected server error occurred, please try again."
}Authorizations
Your Stability API key, sent as a bearer token in the Authorization header.
Response
OK response.
The user's email
Example:
"example@stability.ai"
The user's ID
Example:
"user-1234"
The user's organizations
Show child attributes
Show child attributes
Example:
[
{
"id": "org-5678",
"name": "Another Organization",
"role": "MEMBER",
"is_default": true
},
{
"id": "org-1234",
"name": "My Organization",
"role": "MEMBER",
"is_default": false
}
]
The user's profile picture
Example:
"https://api.stability.ai/example.png"