Totogi Marketplace API
Totogi Marketplace connects communications service providers with pre-negotiated & highly valuable offers from digital service providers to incorporate into product offerings, promotions and bundles via this single and unified API.
Authentication
Before calling the API, obtain an access token from https://oauth.totogi.io/oauth2/token You will need your API Key and Secret Key, which you can find on the Marketplace Profile Page To obtain the token:
- Concatenate your API Key and your Secret Key with a colon separator
- Base64 the concatenated value
- Make an HTTP POST call to the TOKEN endpoint
- Here's an example of the entire process in a single Python utility function that returns the token:
def get_marketplace_token(api_key: str, api_secret: str) -> str:
CREDENTIAL_BYTES = str(api_key + ":" + api_secret).encode("ascii")
CREDENTIAL_B64 = base64.b64encode(CREDENTIAL_BYTES).decode()
headers = {
"Authorization": f"Basic {CREDENTIAL_B64}",
"Content-Type": "application/x-www-form-urlencoded",
}
data = {
"grant_type": "client_credentials",
"scope": "https://myresourceserver1.com/marketplace"
}
response = requests.post(
"https://oauth.totogi.io/oauth2/token",
headers=headers,
data=data
)
token = response.json()["access_token"]
return token
- This token will be needed to make any GraphQL calls.
GraphQL Calls
POST any GraphQL queries or mutations to the API endpoint displayed on the right --> Include an Authorization header with the value containing the access token retrieved in the prior step. For example, assume your GraphQL query or mutation is stored in graphql.query.txt
and your token value is mytoken123asd
. Then, you can use the curl
command from the CLI as follows:
curl -X POST https://api.totogi.io/graphql -H "Authorization: mytoken123asd" -d @graphql.query.txt
You can also use your programming language of choice to make requests. Here's an example with Python.
Contact
Totogi Support
marketplacesupport@totogi.com
API Endpoints
Production Server:
https://marketplace.totogi.com/graphql
Version: 1.0.0
Queries
listUsers
Example
Query
query listUsers {
listUsers {
users {
...UserFragment
}
}
}
Response
{"data": {"listUsers": {"users": [User]}}}
Mutations
createApiKeys
Example
Query
mutation createApiKeys {
createApiKeys {
apiKey
apiSecret
id
createdAt
updatedAt
}
}
Response
{
"data": {
"createApiKeys": {
"apiKey": "xyz789",
"apiSecret": "xyz789",
"id": ID,
"createdAt": "xyz789",
"updatedAt": "xyz789"
}
}
}
generateActivationLink
Example
Query
mutation generateActivationLink($input: generateActivationLinkInput) {
generateActivationLink(input: $input) {
activationLink
}
}
Variables
{"input": generateActivationLinkInput}
Response
{"data": {"generateActivationLink": {"activationLink": "xyz789"}}}
removeApiKey
Example
Query
mutation removeApiKey($input: removeApiKeyInput) {
removeApiKey(input: $input) {
id
owner
apiKey
}
}
Variables
{"input": removeApiKeyInput}
Response
{
"data": {
"removeApiKey": {
"id": ID,
"owner": "abc123",
"apiKey": "abc123"
}
}
}
Types
ActivationLink
Unique links created for an offer on behalf of a subscriber. Enables telcos to track conversion of the links they send out, similar to a URL shortener.
Field Name | Description |
---|---|
id -
ID!
|
|
offerId -
ID!
|
Offer the link was created for |
subscriberId -
String!
|
Subscriber the link was created for. Typically MSISDN but any subscriber ID works |
campaignAlias -
String
|
Example
{
"id": ID,
"offerId": ID,
"subscriberId": "xyz789",
"campaignAlias": "abc123"
}
ActivationLinkUse
Field Name | Description |
---|---|
id -
ID!
|
|
activationLinkId -
String!
|
Activation link that was clicked |
userAgent -
String!
|
User Agent string of user that clicked |
sourceIp -
String!
|
IP address of subscriber that clicked |
Example
{
"id": ID,
"activationLinkId": "xyz789",
"userAgent": "abc123",
"sourceIp": "abc123"
}
AuthRule
Field Name | Description |
---|---|
allow -
AuthStrategy!
|
|
provider -
AuthProvider
|
|
ownerField -
String
|
|
identityClaim -
String
|
|
groupClaim -
String
|
|
groups -
[String]
|
|
groupsField -
String
|
|
operations -
[ModelOperation]
|
|
queries -
[ModelQuery]
|
|
mutations -
[ModelMutation]
|
Example
{
"allow": AuthStrategy,
"provider": AuthProvider,
"ownerField": "xyz789",
"identityClaim": "abc123",
"groupClaim": "xyz789",
"groups": ["abc123"],
"groupsField": "xyz789",
"operations": [ModelOperation],
"queries": [ModelQuery],
"mutations": [ModelMutation]
}
CatalogOffer
Offers that have been added to 'My Catalog', the Telco's clipped offers
Field Name | Description |
---|---|
id -
ID!
|
|
offerId -
ID!
|
Unique offer ID, used in the input to createActivationLink |
offer -
Offer!
|
Related offer from the master catalog |
group -
String!
|
Related group (tenant) |
Example
{
"id": ID,
"offerId": ID,
"offer": Offer,
"group": "abc123"
}
ComissionTrigger
Reflects the different events that can trigger when payouts occur.
Enum Value | Description |
---|---|
|
Paid on conversion to a paid user |
|
Paid on each click |
|
Paid on initiation of a free trial |
Config
Field Name | Description |
---|---|
id -
ID!
|
|
tenantName -
String!
|
|
language -
String!
|
|
homeCountry -
String!
|
|
currency -
String!
|
|
currencySymbol -
String!
|
|
group -
String!
|
Example
{
"id": ID,
"tenantName": "xyz789",
"language": "xyz789",
"homeCountry": "xyz789",
"currency": "xyz789",
"currencySymbol": "abc123",
"group": "abc123"
}
Country
Country used in Marketplace offers
Field Name | Description |
---|---|
id -
ID!
|
|
code -
String!
|
Country Code ISO 3166 |
name -
String!
|
Country name |
defaultCurrency -
String!
|
Country default currency |
defaultLanguage -
String!
|
Country default language code (ISO 639-1) |
Example
{
"id": ID,
"code": "xyz789",
"name": "xyz789",
"defaultCurrency": "abc123",
"defaultLanguage": "xyz789"
}
Float
The Float
scalar type represents signed double-precision fractional values as specified by
IEEE 754.
Example
123.45
ID
The ID
scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4"
) or integer (such as 4
) input value will be accepted as an ID.
Example
object
Int
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
Example
987
ModelSubscriptionMap
Field Name | Description |
---|---|
onCreate -
[String]
|
|
onUpdate -
[String]
|
|
onDelete -
[String]
|
|
level -
ModelSubscriptionLevel
|
Example
{
"onCreate": ["xyz789"],
"onUpdate": ["abc123"],
"onDelete": ["abc123"],
"level": ModelSubscriptionLevel
}
Offer
Marketplace offers that Telcos could extend to their subscriber base
Field Name | Description |
---|---|
id -
ID!
|
Unique offer ID |
name -
String!
|
Offer name |
description -
String!
|
Offer description |
marketingHeadline -
String!
|
Headline displayed to marketers, describing the offer |
marketingDescription -
String!
|
Description displayed to marketers, describing the offer |
endUserHeadline -
String!
|
Text of the end-user headline for an offer |
endUserDescription -
String!
|
Text of the end-user description for an offer |
termsAndConditions -
String!
|
Text of the Terms and Conditions from the Marketplace partner (HTML). Must be accepted by the Telco before adding to their catalog. |
priceType -
PriceType!
|
Price Type associated with this offer |
comissionTrigger -
ComissionTrigger!
|
Commission Trigger associated with this offer |
linkTemplate -
String!
|
Link Template associated with this offer |
logo -
String
|
URL to the logo file for this offer |
disabled -
Boolean
|
The offer is not available (coming soon) |
global -
Boolean
|
The offer is globally available |
category -
Category!
|
Category associated with this offer |
supplier -
Supplier!
|
Reflects the company providing the offer. For example, Apple supplies Apple Music & Apple TV+ |
revenueType -
RevenueType!
|
Reflects the revenue type generated by this offer (e.g. one-time, recurring, etc) |
translations -
[OfferTranslation]
|
Localization of offer user facing offer description |
countries -
[OfferCountry]
|
List of countries that the offer can be marketed in |
Example
{
"id": ID,
"name": "abc123",
"description": "xyz789",
"marketingHeadline": "abc123",
"marketingDescription": "abc123",
"endUserHeadline": "xyz789",
"endUserDescription": "abc123",
"termsAndConditions": "abc123",
"priceType": PriceType,
"comissionTrigger": ComissionTrigger,
"linkTemplate": "xyz789",
"logo": "xyz789",
"disabled": true,
"global": true,
"category": Category,
"supplier": Supplier,
"revenueType": RevenueType,
"translations": [OfferTranslation],
"countries": [OfferCountry]
}
OfferCountry
Some offer attributes are defined at the country level. For example, many offers have localized pricing per country
Field Name | Description |
---|---|
id -
ID!
|
|
offerId -
ID!
|
Related offer ID |
countryId -
ID!
|
Related country ID |
country -
Country!
|
|
currency -
String!
|
Offer currency used in this country |
retailValue -
Float!
|
Retail value of the offer in this country |
retailValueWithoutTaxes -
Float!
|
Retail value of the offer in this country (minus taxes) |
commissionPercentage -
Float
|
Commission as a percent of retail value or transaction value |
commissionValue -
Float
|
Fixed commission regardless of retail value or transaction value |
Example
{
"id": ID,
"offerId": ID,
"countryId": ID,
"country": Country,
"currency": "abc123",
"retailValue": 987.65,
"retailValueWithoutTaxes": 123.45,
"commissionPercentage": 123.45,
"commissionValue": 123.45
}
OfferTranslation
Localization of offer text in different languages
Field Name | Description |
---|---|
id -
ID!
|
Unique ID of this translation |
offerId -
ID!
|
Related offer ID |
language -
String!
|
Language Code (ISO 639-1) |
name -
String!
|
Localized name of the offer |
endUserHeadline -
String!
|
Localized text of the end-user headline for an offer |
endUserDescription -
String!
|
Localized text of the end-user description for an offer |
Example
{
"id": ID,
"offerId": ID,
"language": "abc123",
"name": "abc123",
"endUserHeadline": "xyz789",
"endUserDescription": "abc123"
}
PredictionsActions
Enum Value | Description |
---|---|
|
|
|
|
|
|
|
PriceType
Reflects the different types of pricign that a Marketplace offer can have
Enum Value | Description |
---|---|
|
The same price is charged each month |
|
The price varies and is tied to subscriber selections |
String
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
generateActivationLinkResponse
Field Name | Description |
---|---|
activationLink -
String!
|
Example
{"activationLink": "xyz789"}