Conversions API Gateway for Multiple Accounts Control Plane API: Reference

Account Management

Create Account

Creates a Gateway for multiple accounts, which can be managed by a partner or advertiser depending on the input.

Schema

POST https://{capig_domain}/hub/graphql/ 
_________________________________________________________________________________________________________________
      
mutation CreateTenantMutation(
        $input: CreateTenantInput!
      ) {
        tenantMutations {
          createTenant(input: $input) {
            tenant {
              id
              name
              status
              canPartnerManage
              users {
                id
                email
                roles {
                    name
                    displayName
                }
                tenants {
                    id
                    name
                    status
                    canPartnerManage
                    availableRoles {
                        name
                        displayName
                    }
                }
                isSelf
                canBeDeleted
                defaultTenantId
              }
              availableRoles {
                name
                displayName
              }
              tenantUsage {
                  totalActivePixels
                  totalInactivePixels
                  totalPixels
                  tenantUsageByTraffic {
                    totalEventsReceived
                    totalPixelsWithTraffic
                    publishError
                    durationInHours,
                    lastUpdatedAt
                 }
              }
              canEditTenantSettingsInUI
              canViewTenantInUI
              canEditTenantSettingsInUI
            }
          }
        }
      }
 _________________________________________________________________________________________________________    
input CreateTenantInput {
    name: String!
    canPartnerManage: Boolean!
    adminEmail: String
    eventEnrichment: Boolean!
}
     

Fields

CreateTenantInput

FieldDescription

name
String

Required

Name of the account

canPartnerManage
Boolean

Required
Boolean indicating whether a partner can manage this account

adminEmail
String

Optional
Email address of the admin (This is required if canPartnerManage is false)

eventEnrichment
Boolean

Required
Enhance events with advanced matching data


Returns

CreateTenantResult

FieldDescription

tenant
Tenant

Newly created tenant


Error Codes

CodeDescription

400

Invalid input provided

401

Not authorized to create account

500

Internal server error


Sample Request

Mutation

 mutation CreateTenantMutation(
        $input: CreateTenantInput!
      ) {
        tenantMutations {
          createTenant(input: $input) {
            tenant {
              id
              name
              status
              canPartnerManage
            }
          }
        }
      }

     

Variables

{
   "input": {
       "name": "TestAdvertiserViaAPI",
       "canPartnerManage": true,
       "eventEnrichment": true
       }
}
     

Sample Response

{
   "data": {
       "tenantMutations": {
           "createTenant": {
               "tenant": {
                   "id": "hU2koC34",
                   "name": "TestAdvertiserViaAPI",
                   "status": 0,
                   "canPartnerManage": true
               }
           }
       }
   }
}
     

Delete Account

Deletes an advertiser account.

Schema

POST https://{capig_domain}/hub/graphql/ 
_________________________________________________________________________________________________________________
      
    mutation DeleteTenant($tenantId: String!) {
      tenantMutations {
        deleteTenant(tenantId: $tenantId)
      }
    }

 _________________________________________________________________________________________________________    
tenantId: String!
     

Fields

FieldDescription

tenantId
String

Required

Unique identifier of the account to be deleted.


Returns

Boolean

Indicates whether tenant was successfully deleted.


Error Codes

CodeDescription

400

Invalid input provided

401

Not authorized to delete account

500

Internal server error


Sample Request

Mutation

 mutation DeleteTenant($tenantId: String!) {
   tenantMutations {
   deleteTenant(tenantId: $tenantId)
   }
}
     

Variables

{
   "tenantId": "Tse53QtW"
}
     

Sample Response

{
   "data": {
       "tenantMutations": {
           "deleteTenant": true
       }
   }
}
     

Update Account

Updates the account with a new name, status and permission for the partner to manage the account.

Schema

POST https://{capig_domain}/hub/graphql/ 
_________________________________________________________________________________________________________________
      
 mutation TenantEditNameModalMutation(
  $input: UpdateTenantInput!
) {
  tenantMutations {
    updateTenant(input: $input) {
        tenant {
            id
            name
            status
            canPartnerManage
            users {
                id
                email
                roles {
                    name
                    displayName
                }
                tenants {
                    id
                    name
                    status
                    canPartnerManage
                    availableRoles {
                        name
                        displayName
                    }
                }
                isSelf
                canBeDeleted
                defaultTenantId
            }
            availableRoles {
                name
                displayName
            }
            tenantUsage {
                totalActivePixels
                totalInactivePixels
                totalPixels
                tenantUsageByTraffic {
                   totalEventsReceived
                   totalPixelsWithTraffic
                   publishError
                   durationInHours,
                   lastUpdatedAt
               }
            }
            canEditTenantSettingsInUI
            canViewTenantInUI
            canEditTenantSettingsInUI
        }
    }
  }
}
      
_________________________________________________________________________________________________________    
input UpdateTenantInput {
    tenantId: String!
    name: String
    status: Int
    canPartnerManage: Boolean
}
     

Fields

UpdateTenantInput

FieldDescription

tenantId
String

Required

Unique identifier of the account

name
String

Optional

Name of the account

status
Int

Optional

Account Status (Refer Tenant Object)

canPartnerManage
Boolean

Optional

Indicates whether the partner manage this account


Returns

TenantMutationResponse

FieldDescription

tenant
Tenant

Updated tenant


Error Codes

CodeDescription

400

Invalid input provided

401

Not authorized to update tenant

500

Internal server error


Sample Request

Mutation

mutation TenantEditNameModalMutation(
 $input: UpdateTenantInput!
) {
 tenantMutations {
   updateTenant(input: $input) {
     tenant {
       id
       name
       status
       canPartnerManage
     }
   }
 }
}
     

Variables

{
   "input":{
       "tenantId":"IaoreXfj",
       "name":"Test Account Name Update",
       "status":0,
       "canPartnerManage":true
   }
}
     

Sample Response

{
   "data": {
       "tenantMutations": {
           "updateTenant": {
               "tenant": {
                   "id": "IaoreXfj",
                   "name": "Test Account Name Update",
                   "status": 0,
                   "canPartnerManage": true
               }
           }
       }
   }
}
     

Get Account

Gets the advertiser account corresponding to a unique identifier input.

Schema

POST https://{capig_domain}/hub/graphql/ 
_________________________________________________________________________________________________________________
      
query TenantAccountUsersViewQuery(
  $tenantId: String!
) {
  tenant(tenantId: $tenantId)  {
        id
        name
        status
        canPartnerManage
        users {
            id
            email
            roles {
                name
                displayName
            }
            tenants {
                id
                name
                status
                canPartnerManage
                availableRoles {
                    name
                    displayName
                }
            }
            isSelf
            canBeDeleted
            defaultTenantId
        }
        availableRoles {
            name
            displayName
        }
        tenantUsage {
            totalActivePixels
            totalInactivePixels
            totalPixels
            tenantUsageByTraffic {
               totalEventsReceived
               totalPixelsWithTraffic
               publishError
               durationInHours,
               lastUpdatedAt
            }
        }
        canEditTenantSettingsInUI
        canViewTenantInUI
        canEditTenantSettingsInUI
    }
}
_________________________________________________________________________________________________________    
tenantId: String!
     

Fields

FieldDescription

tenantId
String

Required

Unique identifier of the account to be fetched


Returns

FieldDescription

tenant
Tenant

Account details are fetched


Error Codes

CodeDescription

401

Not authorized to view account

500

Internal server error


Sample Request

Query

query TenantAccountUsersViewQuery(
 $tenantId: String!
) {
 tenant(tenantId: $tenantId) {
   id
   name
   users {
     id
     email
     roles {
         name
         displayName
     }
   }
 }
}
     

Variables

{
   "tenantId":"wW58k7FQ"
}
     

Sample Response

{
   "data": {
       "tenant": {
           "id": "wW58k7FQ",
           "name": "Test Account",
           "users": [
               {
                   "id": "992bc489-a799-4374-8933-0109eed60e3d",
                   "email": "tempuser@test.com",
                   "roles": [
                       {
                           "name": "advertiser-manage-wW58k7FQ",
                           "displayName": "manage"
                       }
                   ]
               }
           ]
       }
   }
}
     

Account Usage

Gets the account usage in terms of active and inactive Pixels corresponding to a unique identifier for the account. Additionally, it returns the traffic usage stats for a duration

Schema

POST https://{capig_domain}/hub/graphql/ 
_________________________________________________________________________________________________________________
      
query TenantUsageQuery(
  $tenantId: String!
) {
    tenantUsage(tenantId: $tenantId) {
        totalActivePixels
        totalInactivePixels
        totalPixels
        tenantUsageByTraffic {
           totalEventsReceived
           totalPixelsWithTraffic
           publishError
           durationInHours,
           lastUpdatedAt
       }
    }
}

_________________________________________________________________________________________________________    
tenantId: String!
     

Fields

FieldDescription

tenantId
String

Required

Unique identifier of the account


Returns

FieldDescription

TenantUsage
TenantUsage

TenantUsage


Error Codes

CodeDescription

401

Not authorized to view account usage

500

Internal server error


Sample Request

Query

query {
   tenantUsage(tenantId: "IaoreXfj"){
       totalActivePixels
       totalInactivePixels
       totalPixels
   }
}
     

Sample Response

{
   "data": {
       "tenantUsage": {
           "totalActivePixels": 3,
           "totalInactivePixels": 1,
           "totalPixels": 4
       }
   }
}