# Customer & Subscriber Management

In Revenium, the following hierarchy and nomenclature is used to manage internal or external customers, users, subscribers, and credentials / API keys.

{% hint style="warning" %}
Always consult the documentation for your specific SDK to understand the correct parameter to use. The parameters below are examples, coding semantics vary across SDKs (i.e. camelCase vs. snake\_case)
{% endhint %}

<table><thead><tr><th width="142.33203125">Term</th><th width="427.12109375">Usage</th><th>Integration Parameter</th></tr></thead><tbody><tr><td><a href="/pages/z8MoECONZ03vUXioyCtT">Organizations</a></td><td><p>Organizations can be either company names or internal business units. The organization object in Revenium supports various metadata fields to allow you to easily sync these objects to internal systems (typically CRM).</p><p><br>Example Values:</p><p>AcmeSoft (customer)</p><p>Finance (internal)</p><p>Organizations can be associated with one or many subscribers</p></td><td><code>organization_id</code></td></tr><tr><td><a href="/pages/IQZ8Ochh6EAos8AUBIfV">Subscribers</a></td><td><p>Subscribers are individuals who consume AI or digital products. The subscriber object contains their email address and name. Email addresses are used to identify the subscriber in API / SDK calls.</p><p>Example Values: joe@acme.com</p><p>Subscribers can be associated with one or many subscriber credentials.</p></td><td><code>subscriber.email, subscriber.id</code></td></tr><tr><td><a href="/pages/j3u212xbTZqlfkmXYGzv">Subscriber Credentials</a></td><td>Credentials contain unique identifiers used by subscribers to access services. In some use cases, it will be the email address of the subscriber, but it could also be an alias for different API keys used by internal developers or external customers, particularly when one subscriber could have multiple API keys and you wish to track usage for each credential separately.<br><br>Example Values: key1-hubspot, key2-financeProject</td><td><code>subscriber.credential.name, subscriber.credential.value</code></td></tr></tbody></table>

## Example API Call Incorporating Customer Data

```python
import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

import openai
import revenium_middleware.openai

# Ensure REVENIUM_METERING_API_KEY & OPENAI_API_KEY are set in your .env file

response = openai.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Please verify you are ready to assist me."
        },
    ],
    max_tokens=500,

     usage_metadata={
         "subscriber": {
           "id": "1473847563",
           "email": "carol@finoptic.com",
           "credential": {
             "name": "Engineering API Key",
             "value": "hak-abc123456"
           }
         },
         "organization_id": "Finoptic Labs",
         "subscription_id": "sub_gold_1234567890",
     },
)
print(response.choices[0].message.content)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revenium.io/customer-and-subscriber-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
