{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/mongodb/main/json-schema/mongodb-org-service-account-schema.json",
  "title": "OrgServiceAccount",
  "description": "Organization Service Account that Atlas created for the organization.",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mongodb-service-accounts-api-openapi.yml#/components/schemas/OrgServiceAccount",
  "properties": {
    "clientId": {
      "description": "The Client ID of the Service Account.",
      "pattern": "^mdb_sa_id_[a-fA-F\\d]{24}$",
      "type": "string"
    },
    "createdAt": {
      "description": "The date that the Service Account was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.",
      "format": "date-time",
      "type": "string"
    },
    "description": {
      "description": "Human readable description for the Service Account.",
      "type": "string"
    },
    "name": {
      "description": "Human-readable name for the Service Account.",
      "type": "string"
    },
    "roles": {
      "description": "A list of Organization roles associated with the Service Account.",
      "items": {
        "description": "Organization roles available for Service Accounts.",
        "enum": [
          "ORG_MEMBER",
          "ORG_READ_ONLY",
          "ORG_BILLING_ADMIN",
          "ORG_BILLING_READ_ONLY",
          "ORG_STREAM_PROCESSING_ADMIN",
          "ORG_GROUP_CREATOR",
          "ORG_OWNER"
        ],
        "type": "string"
      },
      "type": "array",
      "uniqueItems": true
    },
    "secrets": {
      "description": "A list of secrets associated with the specified Service Account.",
      "items": {
        "$ref": "#/$defs/ServiceAccountSecret"
      },
      "type": "array",
      "uniqueItems": true
    }
  },
  "readOnly": true,
  "type": "object",
  "$defs": {
    "ServiceAccountSecret": {
      "properties": {
        "createdAt": {
          "description": "The date that the secret was created on. This parameter expresses its value in the ISO 8601 timestamp format in UTC.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "expiresAt": {
          "description": "The date for the expiration of the secret. This parameter expresses its value in the ISO 8601 timestamp format in UTC.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "id": {
          "description": "Unique 24-hexadecimal digit string that identifies the secret.",
          "pattern": "^([a-f0-9]{24})$",
          "readOnly": true,
          "type": "string"
        },
        "lastUsedAt": {
          "description": "The last time the secret was used. This parameter expresses its value in the ISO 8601 timestamp format in UTC.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "maskedSecretValue": {
          "description": "The masked Service Account secret.",
          "readOnly": true,
          "type": "string"
        },
        "secret": {
          "description": "The secret for the Service Account. It will be returned only the first time after creation.",
          "readOnly": true,
          "type": "string"
        }
      },
      "required": [
        "createdAt",
        "expiresAt",
        "id"
      ],
      "type": "object"
    }
  }
}