Skip to content

License Usage

Reference for the license_usage endpoints of the Surfmeter API.

Surfmeter API – License Usage v1

The Surfmeter API lets you manage clients, users, capabilities, measurements, and organization-wide settings programmatically.


Servers

Description URL
https://surfmeter-server.{host}/client_admin_api/v1 https://surfmeter-server.{host}/client_admin_api/v1

License Usage


GET /license_usage

Input parameters

Parameter In Type Default Nullable Description
ApiKeyAuth header string N/A No API key used on every request. Create keys in the Surfmeter Dashboard under Keys → Surfmeter API Keys.
end_time query string No ISO-8601 timestamp restricting the report to measurements on or before this point in time. Parsed with Ruby's Time.parse so most common formats are accepted.
extended query boolean No When true, returns the extended monthly breakdown including license units and per-subject distribution. When false or omitted, returns the simple monthly unique-client count.
registration_key_id query integer No Restricts the extended report to clients registered with this registration key. Requires extended=true; without it the request is rejected with a 400. The key must belong to the current data owner, otherwise the request is rejected with a 404.
start_time query string No ISO-8601 timestamp restricting the report to measurements on or after this point in time. Parsed with Ruby's Time.parse so most common formats are accepted.

Response 200 OK

{
    "monthly_usage": [
        {
            "month": "string",
            "license_units": 0,
            "unique_clients": 0,
            "breakdown_by_subject_count": {}
        }
    ],
    "total_units": 0,
    "usage_by_registration_key": [
        {
            "registration_key_id": 0,
            "registration_key": "string",
            "comment": "string",
            "total_units": 0,
            "total_unique_clients": 0,
            "monthly_usage": [
                {
                    "month": "string",
                    "license_units": 0,
                    "unique_clients": 0
                }
            ]
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "description": "Response for extended license usage index action with license units",
    "type": "object",
    "required": [
        "monthly_usage",
        "total_units",
        "usage_by_registration_key"
    ],
    "properties": {
        "monthly_usage": {
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "month",
                    "license_units",
                    "unique_clients",
                    "breakdown_by_subject_count"
                ],
                "properties": {
                    "month": {
                        "type": "string",
                        "description": "Month in YYYY-MM format"
                    },
                    "license_units": {
                        "type": "integer",
                        "description": "Total license units consumed in this month"
                    },
                    "unique_clients": {
                        "type": "integer",
                        "description": "Number of unique clients in this month"
                    },
                    "breakdown_by_subject_count": {
                        "type": "object",
                        "description": "Breakdown by number of subjects measured per client",
                        "additionalProperties": {
                            "type": "object",
                            "required": [
                                "clients",
                                "units"
                            ],
                            "properties": {
                                "clients": {
                                    "type": "integer",
                                    "description": "Number of clients with this subject count"
                                },
                                "units": {
                                    "type": "integer",
                                    "description": "License units consumed by clients with this subject count"
                                }
                            }
                        }
                    }
                }
            }
        },
        "total_units": {
            "type": "integer",
            "description": "Total license units across all months"
        },
        "usage_by_registration_key": {
            "type": "array",
            "description": "Per-registration-key breakdown of the license usage. Always present, including when the request is restricted to a single key via registration_key_id, in which case the array contains only that key's entry. Sorted by total_units descending, with the entry for clients without a registration key (registration_key_id: null) always last.",
            "items": {
                "type": "object",
                "required": [
                    "registration_key_id",
                    "registration_key",
                    "comment",
                    "total_units",
                    "total_unique_clients",
                    "monthly_usage"
                ],
                "properties": {
                    "registration_key_id": {
                        "type": "integer",
                        "description": "ID of the registration key. Null for clients registered without a registration key, clients whose registration key has since been deleted, and clients whose own record was deleted since. A non-null id always refers to a key that still exists.",
                        "nullable": true
                    },
                    "registration_key": {
                        "type": "string",
                        "description": "The registration key string. Null when registration_key_id is null.",
                        "nullable": true
                    },
                    "comment": {
                        "type": "string",
                        "description": "Comment/label set on the registration key. Null when registration_key_id is null, or when the key has no comment.",
                        "nullable": true
                    },
                    "total_units": {
                        "type": "integer",
                        "description": "Total license units consumed by this key's clients across all months in the report"
                    },
                    "total_unique_clients": {
                        "type": "integer",
                        "description": "Sum of the unique-client counts across each month for this key (client-months); a client active in multiple months is counted once per month, not once overall"
                    },
                    "monthly_usage": {
                        "type": "array",
                        "description": "Per-month usage for this registration key, covering every month of the report's range with zeros for months without activity",
                        "items": {
                            "type": "object",
                            "required": [
                                "month",
                                "license_units",
                                "unique_clients"
                            ],
                            "properties": {
                                "month": {
                                    "type": "string",
                                    "description": "Month in YYYY-MM format"
                                },
                                "license_units": {
                                    "type": "integer",
                                    "description": "License units consumed by this key's clients in this month"
                                },
                                "unique_clients": {
                                    "type": "integer",
                                    "description": "Number of unique clients belonging to this key that were active in this month"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

GET /license_usage/export

Input parameters

Parameter In Type Default Nullable Description
ApiKeyAuth header string N/A No API key used on every request. Create keys in the Surfmeter Dashboard under Keys → Surfmeter API Keys.

Response 200 OK


Schemas

LicenseUsageExtendedIndexResponse

Name Type
monthly_usage Array<Properties: month, license_units, unique_clients, breakdown_by_subject_count>
total_units integer
usage_by_registration_key Array<Properties: registration_key_id, registration_key, comment, total_units, total_unique_clients, monthly_usage>

Security schemes

Name Type Scheme Description
ApiKeyAuth apiKey API key used on every request. Create keys in the Surfmeter Dashboard under Keys → Surfmeter API Keys.