Crea una cuenta de servicio al cliente con ámbito de organización y devuelve su secreto una vez. el rol es obligatorio y acepta como máximo un nombre no vacío: ORG_GROUP_CREATOR o ORG_READ_ONLY. Los nombres de motor de agente heredado (ORG_ADMIN, ORG_MEMBER) todavía se aceptan. role_assignments refleja el rol del motor de agente almacenado. Requiere ORG_ADMIN.
Cuerpo
Requerido
Crear solicitud
-
La longitud máxima es
500. -
Lista de permitidos de IP/CIDR opcional. Vacío u omitido significa sin restricciones. Como máximo 100 entradas.
No más de
100elementos. -
La longitud máxima es
100. -
Roles es el conjunto inicial de roles. Se requiere exactamente un rol. Las cuentas de la organización aceptan ORG_GROUP_CREATOR o ORG_READ_ONLY. Las cuentas de proyecto aceptan PROJECT_OWNER, PROJECT_READ_ONLY o AGENT_DEVELOPER. Los nombres heredados de motor de agente (ORG_ADMIN, ORG_MEMBER, PROJECT_MEMBER) todavía se aceptan. role_assignments refleja el rol almacenado del motor de agente 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 la API no compatible o con formato incorrecto, una operación no disponible en el contrato publicado seleccionado o una representación inaceptable (incluidos parámetros de tipo de medios no compatibles o SSE excluido). Los fallos existentes de autenticación, autorización y límite de peticiones tienen prioridad.
-
Creado.
-
Solicitud incorrecta
-
Forbidden
-
No encontrado
-
Conflicto
-
Demasiadas solicitudes
-
Error interno del servidor
-
Servicio no disponible
curl \
--request POST 'https://agentengine.mongodb.com/api/v1/organizations/{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
}