Get Usage

Endpoint:

This endpoint provides information about the plan and pack usage details for a particular group. It will give you information about the number of available resources (such as documents, pages, etc. – depending on what your plan(s)/packs(s) are configured with) for the group.

POST Parameters

ParameterRequiredValueDescription
api_key{key}An API key that has access to the resource you want to query for
group_id{integer}The group you wish to get the usage details for. If not submitted then the group of the API key will be used.

Response Information

ElementDescription
<status>A status code in response to the operation
<message>Additional information about the operation – human readable
<plan>Container for current billing plan information
<plan>→<id>The unique ID of the billing plan
<plan>→<plan_name>The name of the billing plan
<plan>→<price>The price of the plan
<plan>→<price_currency>The currency code for the price (e.g., USD, NZD)
<plan>→<allowed_documents>The total number of documents allowed in this plan
<plan>→<used_documents>The number of documents already processed
<plan>→<available_documents>The number of documents remaining in the plan
<plan>→<start_date>The date when the plan started
<plan>→<expiry_date>The date when the plan expires
<plan>→<group_id>The ID of the group this plan is associated with

Example

Sample Request

POST https://api-app.xtracta.com/v1/billings/usage HTTP/1.1
api_key=123&group_id=456

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<billings_response>
    <status>200</status>
    <message>The request has been successfully processed</message>
    <plan>
        <id>1</id>
        <plan_name>Plan A</plan_name>
        <price>15</price>
        <price_currency>NZD</price_currency>
        <allowed_documents>250</allowed_documents>
        <used_documents>0</used_documents>
        <available_documents>250</available_documents>
        <start_date>2015-02-27 12:10:04 (GMT)</start_date>
        <expiry_date>2015-03-27 12:10:03 (GMT)</expiry_date>
        <group_id>481</group_id>
    </plan>
</billings_response>

Schema Definition

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

  <xs:simpleType name="ConfidenceType">
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:integer">
          <xs:minInclusive value="0"/>
          <xs:maxInclusive value="100"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value=""/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:complexType name="PlanType">
    <xs:sequence>
      <xs:element name="id" type="xs:positiveInteger"/>
      <xs:element name="plan_name" type="xs:string"/>
      <xs:element name="price" type="xs:decimal"/>
      <xs:element name="price_currency" type="xs:string"/>
      <xs:element name="allowed_documents" type="xs:nonNegativeInteger"/>
      <xs:element name="used_documents" type="xs:nonNegativeInteger"/>
      <xs:element name="available_documents" type="xs:nonNegativeInteger"/>
      <xs:element name="start_date" type="xs:string"/>
      <xs:element name="expiry_date" type="xs:string"/>
      <xs:element name="group_id" type="xs:positiveInteger" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="billings_response">
    <xs:complexType>
      <xs:sequence>
      <xs:element name="status" type="xs:positiveInteger" minOccurs="0"/>
      <xs:element name="message" type="xs:string"/>
      <xs:element name="plan" type="PlanType"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>