Crea una cuenta de servicio al cliente con ámbito de proyecto y devuelve su clave secreta una sola vez. El rol acepta exactamente un nombre: PROJECT_OWNER, PROJECT_READ_ONLY o AGENT_DEVELOPER. PROJECT_MEMBER también se acepta. role_assignments muestra el rol de Agent Engine almacenado. Requiere PROJECT_OWNER; ORG_ADMIN para la organización propietaria también se acepta.
Cuerpo
Requerido
Crear solicitud
-
La longitud máxima es
500. -
Lista de direcciones IP/CIDR permitidas (opcional). Si está vacía o se omite, no tiene restricciones. Máximo 100 entradas.
No más de
100elementos. -
La longitud máxima es
100. -
Roles es el conjunto de roles inicial. Se requiere exactamente un rol. Las cuentas de organización aceptan ORG_GROUP_CREATOR u ORG_READ_ONLY. Las cuentas de proyecto aceptan PROJECT_OWNER, PROJECT_READ_ONLY o AGENT_DEVELOPER. Los nombres heredados de Agent Engine (ORG_ADMIN, ORG_MEMBER, PROJECT_MEMBER) siguen siendo aceptados. role_assignments muestra el rol de Agent Engine almacenado al que se resuelven esos nombres.
Al menos
1elemento pero no más de1. -
TTL secreto opcional en horas. Por defecto es 2160 (90 días) cuando se omite.
Respuestas
-
Versión de API no compatible o con formato incorrecto, operación no disponible en el contrato publicado seleccionado o representación inaceptable (incluidos parámetros de tipo de medio no compatibles o SSE excluidos). Los fallos de autenticación, autorización y límite de velocidad existentes tienen prioridad.
-
Creado.
-
Solicitud incorrecta
-
Forbidden
-
No encontrado
-
Conflicto
-
Demasiadas peticiones
-
Error interno del servidor
-
Servicio no disponible
curl \
--request POST 'https://agentengine.mongodb.com/api/v1/projects/{id}/service-accounts' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"description": "string",
"ip_access_list": [
"string"
],
"name": "string",
"roles": [
"string"
],
"secret_expires_after_hours": 42
}'
{
"description": "string",
"ip_access_list": [
"string"
],
"name": "string",
"roles": [
"string"
],
"secret_expires_after_hours": 42
}
{
"detail": "This operation is not available in API version 2026-09-20-preview.",
"error": 406,
"errorCode": "OPERATION_NOT_IN_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "This operation supports text/event-stream, which the Accept header excludes. Remove unsupported media-type parameters or accept this type with a positive q value.",
"error": 406,
"errorCode": "UNACCEPTABLE_MEDIA_TYPE",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "The requested API version is not supported. Supported versions: 2026-09-20-preview.",
"error": 406,
"errorCode": "UNSUPPORTED_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"detail": "This operation is not available in API version 2026-09-20-preview.",
"error": 406,
"errorCode": "OPERATION_NOT_IN_API_VERSION",
"parameters": [
"Accept"
],
"reason": "Not Acceptable"
}
{
"client_secret": "string",
"service_account": {
"active_secret": {
"created_at": "string",
"expires_at": "string",
"last_used_at": "string",
"masked_value": "string"
},
"client_id": "string",
"created_at": "string",
"description": "string",
"id": "string",
"ip_access_list": [
"string"
],
"is_active": true,
"is_system_managed": true,
"name": "string",
"org_id": "string",
"owner": "string",
"project_id": "string",
"role_assignments": [
{
"org_id": "string",
"project_id": "string",
"role": "string"
}
],
"type": "string",
"updated_at": "string"
}
}
{
"client_secret": "string",
"service_account": {
"active_secret": {
"created_at": "string",
"expires_at": "string",
"last_used_at": "string",
"masked_value": "string"
},
"client_id": "string",
"created_at": "string",
"description": "string",
"id": "string",
"ip_access_list": [
"string"
],
"is_active": true,
"is_system_managed": true,
"name": "string",
"org_id": "string",
"owner": "string",
"project_id": "string",
"role_assignments": [
{
"org_id": "string",
"project_id": "string",
"role": "string"
}
],
"type": "string",
"updated_at": "string"
}
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
# Headers
Retry-After: string
# Payload
{
"code": "string",
"error": "string",
"success": true
}
# Headers
Retry-After: string
# Payload
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
{
"code": "string",
"error": "string",
"success": true
}
# Headers
Retry-After: string
# Payload
{
"code": "string",
"error": "string",
"success": true
}
# Headers
Retry-After: string
# Payload
{
"code": "string",
"error": "string",
"success": true
}