Usage Records

Stream Updates about the SMS and Data Volume Usage.

The 1NCE Data Streamer Service offers a stream of Event and Usage Records. This chapter will focus on the Usage Record specification. In this chapter, the focus lies on the JSON Object format. For other integrations, the format might be different, but the data fields are comparable. Please refer to the setup of the offered integrations to get more information about the specific data formats used.

Usage Records are triggered on SIM level and are based on the following rules:

  • For an ongoing PDP data connection, at most, one record every 15 minutes if more than 100kB of data was used. This record contains the aggregated usage since the start of the PDP or since the last usage record.
  • One record on the closure a PDP data connection. This record contains the usage since the last record or the entire aggregated usage if no prior record has been provided for the closed PDP data connection.
  • For SMS a usage record is provided per individual MO-/MT-SMS send.

In the following, the two types of Usage Records and the included data fields will be shown. The 1NCE Data Streamer provides two types of records for SMS and Data volume usage.


Example Usage Records

Let us start with a few Example Usage Records in the form of JSON Objects from the Data Streamer. Please note that some fields only include placeholder or example values.

05_Data_Usage_Record
{
    "imsi": "<imsi>",
    "organisation": {
        "name": "8100xxxx",
        "id": 1234
    },
    "start_timestamp": "2021-08-09T12:59:05Z",
    "sim": {
        "msisdn": "<msisdn>",
        "iccid": "<icc>",
        "id": 123456,
        "production_date": "2018-04-17T15:01:50Z"
    },
    "currency": {
        "id": 1,
        "symbol": "€",
        "code": "EUR"
    },
    "operator": {
      "id": 2,
      "name": "T-Mobile",
      "mnc": "01",
      "country": {
        "id": 74,
        "mcc": "262",
        "name": "Germany"
      }
	},
    "tariff": {
        "ratezone": {
            "name": "Rate Zone 2 (EU - DE)",
            "id": 2067
        },
        "name": "1NCE Production 01",
        "id": 398
    },
    "imsi_id": 1234567,
    "traffic_type": {
        "description": "Data",
        "id": 5
    },
    "id": 1234567890,
    "end_timestamp": "2021-08-09T12:51:20Z",
    "endpoint": {
        "tags": null,
        "ip_address": "<ip_address>",
        "name": "<name>",
        "imei": "<imei>",
        "id": 12345678,
				"balance": null
    },
    "cost": 0.001176,
    "volume": {
        "total": 0.001176,
        "tx": 0.001176,
        "rx": 0.0
    }
}
06_SMS_Usage_Record
{
	"imsi": "<imsi>",
	"organisation": {
		"name": "8100xxxx",
		"id": 12345
	},
	"start_timestamp": "2021-08-09T12:51:20Z",
	"sim": {
		"msisdn": "<msisdn>",
		"iccid": "<iccid>",
		"id": 123456,
		"production_date": "2018-04-17T15:01:50Z"
	},
	"currency": {
		"id": 1,
		"symbol": "€",
		"code": "EUR"
	},
	"operator": {
		"mnc": "01",
		"name": "T-Mobile",
		"country": {
			"name": "Germany",
			"id": 74,
			"mcc": "262"
		},
		"id": 5
	},
	"tariff": {
		"ratezone": {
			"name": "Zone 1",
			"id": 2067
		},
		"name": "Tariff 1",
		"id": 398
	},
	"imsi_id": 1234567,
	"traffic_type": {
		"description": "SMS",
		"id": 6
	},
	"id": 1234567890,
	"end_timestamp": "2021-08-09T12:51:20Z",
	"endpoint": {
		"tags": null,
		"ip_address": "<ip_address>",
		"name": "<name>",
		"imei": "<imei>",
    "balance": null,
		"id": 1234567
	},
	"cost": 1.0,
	"volume": {
		"total": 1.0,
		"tx": 0.0,
		"rx": 1.0
	}
}

Usage Data Properties

These are the main properties of a Usage Record that help to identify the endpoint and provide an insight into the volume used.

PropertyData TypeDescription
idLONG (64-bit integer)Unique ID for each Usage Record sent. Duplicate received event IDs indicate possible retransmissions.
costDECIMAL(14,10)Does not reflect the real world cost, 1:1 translation of usage.
currencyJSON ObjectCurrency object with information about the cost currency. See Currency for more information.
start_timestampTIMESTAMP (UTC)Timestamp with date and time of the usage start in the ISO 8601 format.
end_timestampTIMESTAMP (UTC)Timestamp with date and time of the usage end in the ISO 8601 format.
volumeJSON ObjectObject with the exact volume used as part of the Usage Record. See Volume for more information.
imsiSTRINGThe International Mobile Subscriber Identity as String.
organisationJSON ObjectObject with the ID and the name of the organization. See Event Organization for more information.
operatorJSON ObjectOperator information, see Operator for more information.
simJSON ObjectSubscriber Identification Module, see SIM for more information.
tariffJSON ObjectTariff details, see Tariff for more information.
traffic_typeJSON ObjectType of traffic of the Usage Record, see Traffic Type for more information.
endpointJSON ObjectEndpoint/Device information object, see Endpoint for more information.

Cost Object

The cost object is set as a 1:1 relation to the used volume. It does not reflect the real world cost.

PropertyData TypeDescription
idINTEGERUnique identifier of the currency of indicated cost.
symbolUTF-8 Char STRINGSymbol of the currency as UTF-8 Char.
codeISO 4217 STRINGCurrency Code in ISO format.

Organisation Object

Information about the organization of the SIM that generated the volume usage record.

PropertyData TypeDescription
idINTEGERUnique identifier of the organisation.
nameSTRING1NCE Customer ID.

SIM Object

Details about the SIM that is responsible for the volume usage.

PropertyData TypeDescription
idINTEGERUnique ID of the SIM.
iccidSTRINGIntegrated Circuit Card Identifier of the SIM.
msisdnSTRINGMobile Subscriber ISDN of the SIM Card.
production_dateTIMESTAMP (UTC)Timestamp when the SIM was produced in the ISO 8601 format.

Operator Object

Operator the SIM was attached to when the usage was generated.

PropertyData TypeDescription
idINTEGERUnique identifier of visited operator.
mncSTRINGMobile Network Code of the roaming operator.
nameSTRINGName of the roaming mobile operator.
countryJSON ObjectCountry information object, see Country for more information.

Country Object

Country of the device with the 1NCE SIM where the usage was generated.

PropertyData TypeDescription
idINTEGERUnique identifier of visited country.
mccSTRINGMobile Country Code of the operator.
nameSTRINGName of visited country.

Tariff Object

Specific tariff assigned to the 1NCE SIM.

PropertyData TypeDescription
idINTEGERUnique identifier of applied tariff.
nameSTRINGName of the applied tariff.
ratezoneJSON ObjectRatezone information object, see Ratezone for more information.

Ratezone Object

The ratezone in which the SIM generated the indicated usage.

PropertyData TypeDescription
idINTEGERUnique identifier of applied Ratezone.
nameSTRINGName of the Ratezone.

Traffic Type Object

Identifies what kind of traffic was used and is shown in the Usage Record. This could either be Data or SMS.

PropertyData TypeDescription
idINTEGERUnique identifier of traffic type.
5 = Data
6 = SMS
nameSTRINGName of traffic type either "Data" or "SMS".

Endpoint Object

Details about the endpoint/device with the 1NCE SIM that generated the usage.

PropertyData TypeDescription
idINTEGERUnique identifier of traffic type.
tagsSTRINGUser-defined tags set for this endpoint.
ip_addressSTRINGThe IP address assigned to this endpoint.
imeiSTRINGThe IMEI of the endpoint hardware.
nameSTRINGThe user-defined name set for this endpoint.
balanceSTRING

Volume Object

Exact volume, either data in MegaBytes or number of SMS used by the SIM.

PropertyData TypeDescription
totalDECIMAL(14,6)Total traffic consumed, sum of tx and rx.
txDECIMAL(14,6)Dependent on Traffic Type:
Upstream traffic (MB) send by the endpoint.
or
Number of sent MO-SMS
rxDECIMAL(14,6)Dependent on Traffic Type:
Downstream traffic (MB) received by the endpoint.
or
Number of sent MT-SMS