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:

  1. Concatenate your API Key and your Secret Key with a colon separator
  2. Base64 the concatenated value
  3. Make an HTTP POST call to the TOKEN endpoint
  4. 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
  1. 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

Returns a ListUsersResponse

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"
    }
  }
}

removeApiKey

Returns a UserApiKeys

Name Description
input - removeApiKeyInput

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

AWSDate

Example
object

AWSDateTime

Example
object

AWSEmail

Example
object

AWSIPAddress

Example
object

AWSJSON

Example
object

AWSPhone

Example
object

AWSTime

Example
object

AWSTimestamp

Example
object

AWSURL

Example
object

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"
}

AuthProvider

Enum Value Description

apiKey

iam

oidc

userPools

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]
}

AuthStrategy

Enum Value Description

owner

groups

private

public

Boolean

The Boolean scalar type represents true or false.

Example
false

Campaign

Field Name Description
id - ID!
campaignName - String!
group - String!
Example
{"id": ID, "campaignName": "abc123", "group": "abc123"}

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"
}

Category

Used to classify Offers into categories like Streaming Video and Travel

Field Name Description
id - ID!
name - String!
Example
{"id": ID, "name": "abc123"}

ComissionTrigger

Reflects the different events that can trigger when payouts occur.

Enum Value Description

conversionToPaidUser

Paid on conversion to a paid user

payPerClick

Paid on each click

startFreeTrial

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"
}

CreateUserError

Field Name Description
message - String
code - String
time - String
statusCode - Int
Example
{"message": "abc123", "code": "abc123", "time": "xyz789", "statusCode": 123}

CreateUserResult

CreateUserSuccess

Field Name Description
username - String!
Example
{"username": "abc123"}

DeleteUserError

Field Name Description
message - String
code - String
time - String
statusCode - Int
Example
{"message": "abc123", "code": "xyz789", "time": "abc123", "statusCode": 123}

DeleteUserResult

DeleteUserSuccess

Field Name Description
username - String!
Example
{"username": "abc123"}

Float

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Example
123.45

HttpHeader

Input Field Description
key - String
value - String
Example
{"key": "abc123", "value": "abc123"}

HttpMethod

Enum Value Description

PUT

POST

GET

DELETE

PATCH

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

ListUsersResponse

Field Name Description
users - [User]
Example
{"users": [User]}

ModelMutation

Enum Value Description

create

update

delete

ModelMutationMap

Input Field Description
create - String
update - String
delete - String
Example
{"create": "xyz789", "update": "xyz789", "delete": "xyz789"}

ModelOperation

Enum Value Description

create

update

delete

read

ModelQuery

Enum Value Description

get

list

ModelQueryMap

Input Field Description
get - String
list - String
Example
{"get": "abc123", "list": "abc123"}

ModelSubscriptionLevel

Enum Value Description

off

public

on

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

identifyText

identifyLabels

convertTextToSpeech

translateText

PriceType

Reflects the different types of pricign that a Marketplace offer can have

Enum Value Description

fixedMonthly

The same price is charged each month

perTransaction

The price varies and is tied to subscriber selections

RevenueType

Revenue Type for a Marketplace offer. One-time or Recurring, for example

Field Name Description
id - ID!
name - String!
description - String!
Example
{"id": ID, "name": "abc123", "description": "abc123"}

SearchableQueryMap

Input Field Description
search - String
Example
{"search": "xyz789"}

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.

Supplier

Suppliers of Marketplace offers. For example, Apple supplies Apple Music & Apple TV+

Field Name Description
id - ID!
name - String!
description - String!
Example
{"id": ID, "name": "abc123", "description": "abc123"}

TimestampConfiguration

Input Field Description
createdAt - String
updatedAt - String
Example
{"createdAt": "xyz789", "updatedAt": "xyz789"}

User

Field Name Description
username - String!
email - String
createdAt - String!
updatedAt - String!
status - String!
Example
{
  "username": "xyz789",
  "email": "xyz789",
  "createdAt": "abc123",
  "updatedAt": "xyz789",
  "status": "xyz789"
}

UserApiKeys

Field Name Description
id - ID!
owner - String
apiKey - String!
Example
{"id": ID, "owner": "xyz789", "apiKey": "xyz789"}

UserData

Field Name Description
username - ID!
group - String!
owner - String
lastLoginAt - String
roles - [String]
Example
{
  "username": ID,
  "group": "xyz789",
  "owner": "xyz789",
  "lastLoginAt": "abc123",
  "roles": ["abc123"]
}

createApiKeysResponse

Field Name Description
apiKey - String!
apiSecret - String!
id - ID!
createdAt - String!
updatedAt - String!
Example
{
  "apiKey": "xyz789",
  "apiSecret": "abc123",
  "id": ID,
  "createdAt": "xyz789",
  "updatedAt": "xyz789"
}

generateActivationLinkInput

Input Field Description
offerId - String!
subscriberId - String!
campaignName - String
Example
{"offerId": "abc123", "subscriberId": "xyz789", "campaignName": "abc123"}

generateActivationLinkResponse

Field Name Description
activationLink - String!
Example
{"activationLink": "xyz789"}

redeemActivationLinkResponse

Field Name Description
activationLinkId - String!
offerLink - String!
offerId - String!
Example
{"activationLinkId": "abc123", "offerLink": "abc123", "offerId": "xyz789"}

removeApiKeyInput

Input Field Description
id - ID!
Example
{"id": ID}