Skip to content

Authorize user-id to role mappings for JIT access

post/v1/projects/{ref}/database/jit

Authorizes the request to assume a role in the project database

OAuth scopes

  • database:read

The fine-grained token must include the following permissions to access this endpoint:

  • database_jit_read

Path parameters

  • ref
    Required
    string

    Project ref

Body

  • role
    Required
    string
  • rhost
    Required
    any of the following options

Response codes

  • 200
  • 401
  • 403
  • 429
  • 500

Response (200)

{
"user_id": "00000000-0000-0000-0000-000000000000",
"act": "lorem",
"user_role": {
"role": "lorem",
"expires_at": 42,
"allowed_networks": {
"allowed_cidrs": [
{
"cidr": "144.144.144.144/14"
}
],
"allowed_cidrs_v6": [
{
"cidr": "::/104"
}
]
},
"branches_only": true
}
}
{
"type": "object",
"properties": {
"user_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"act": {
"type": "string"
},
"user_role": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"expires_at": {
"type": "number"
},
"allowed_networks": {
"type": "object",
"properties": {
"allowed_cidrs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"cidr": {
"type": "string",
"format": "cidrv4",
"pattern": "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$"
}
},
"required": [
"cidr"
]
}
},
"allowed_cidrs_v6": {
"type": "array",
"items": {
"type": "object",
"properties": {
"cidr": {
"type": "string",
"format": "cidrv6",
"pattern": "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$"
}
},
"required": [
"cidr"
]
}
}
}
},
"branches_only": {
"type": "boolean"
}
},
"required": [
"role"
]
}
},
"required": [
"user_role"
]
}