Skip to content

Create a new subscription

POST /api/v1/new-subscription

POST /maas/api/v1/new-subscription

Creates a new MaaSSubscription and its associated MaaSAuthPolicy. K8s calls: CREATE /k8s/v1/maassubscription, CREATE /k8s/v1/maasauthpolicy

Authorization

Request body

Required.

Content type: application/json

Schema: CreateSubscriptionRequest

Example:

{
  "name": "team-alpha-sub",
  "namespace": "maas-system",
  "owner": {
    "groups": [
      {
        "name": "team-alpha"
      }
    ]
  },
  "modelRefs": [
    {
      "name": "llama-2-7b-chat",
      "namespace": "maas-models",
      "tokenRateLimits": [
        {
          "limit": 50000,
          "window": "24h"
        }
      ]
    }
  ],
  "inferencePriority": 0
}

Responses

Status Description Response body
201 Created

Subscription and auth policy created successfully

CreateSubscriptionResponse

application/json

400 Bad Request

Bad Request. Invalid subscription specification.

ErrorResponse

application/json

401 Unauthorized

Unauthorized

None
403 Forbidden

Forbidden

None
409 Conflict

Conflict. Subscription with this name already exists.

ErrorResponse

application/json

500 Internal Server Error

Internal Server Error

ErrorResponse

application/json

Example request

curl -X POST "/maas/api/v1/new-subscription" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "team-alpha-sub",
  "namespace": "maas-system",
  "owner": {
    "groups": [
      {
        "name": "team-alpha"
      }
    ]
  },
  "modelRefs": [
    {
      "name": "llama-2-7b-chat",
      "namespace": "maas-models",
      "tokenRateLimits": [
        {
          "limit": 50000,
          "window": "24h"
        }
      ]
    }
  ],
  "inferencePriority": 0
}'

Example response

201 Created, application/json

{
  "subscription": {
    "name": "premium-team-sub",
    "namespace": "maas-system",
    "phase": "Pending",
    "inferencePriority": 10,
    "owner": {
      "groups": [
        {
          "name": "premium-users"
        }
      ]
    },
    "modelRefs": [
      {
        "name": "llama-2-7b-chat",
        "namespace": "maas-models",
        "tokenRateLimits": [
          {
            "limit": 100000,
            "window": "24h"
          }
        ]
      }
    ],
    "creationTimestamp": "2025-03-16T10:00:00Z"
  },
  "authPolicy": {
    "name": "premium-team-sub-policy",
    "namespace": "maas-system",
    "phase": "Pending",
    "modelRefs": [
      {
        "name": "llama-2-7b-chat",
        "namespace": "maas-models"
      }
    ],
    "subjects": {
      "groups": [
        {
          "name": "premium-users"
        }
      ]
    }
  }
}