Reseller API: Manage Customers

Initial set up for a customer account

To manage a customer account, first order a new or transferred customer account and then use the API's Subscription resource to create and manage this customer's payment plan and product SKUs.

Before ordering a new customer account, establish if the customer already exists by using the customer's primary domain name as described in Retrieve a customer account you do not manage. This example uses example.com as the primary domain name:

GET https://www.googleapis.com/apps/reseller/v1/customers/example.com

Response returns an HTTP 404 error

The customer is new to Google and does not have an account.

  • Confirm that your customer records do not hold old customer data with a potential mismatch of a customer's primary domain name and the unique Google customer identifier. When a previously deleted Google account is reinstated, it is treated as a new account and has a new customerId value even though the account may retain the same customerDomain value.
  • Order a new customer account.
  • Create a subscription for this new customer account.

Response returns the minimal customer account information

The customer is presently managed either by Google or another reseller if the response only returns the customerId and customerDomain information.

Response returns the full customer settings

The customer is one of your existing customers. The customer is already managed by your reseller account. Using the API, you can manage this customer's account and subscription settings.

Order a new customer account

To create a new customer account, use the following POST HTTP request and include the authorization token described in Authorizing requests. For the request and response properties, see the reference documentation. Country code restrictions apply. Confirm that the customer's country is approved for resale.

POST https://www.googleapis.com/apps/reseller/v1/customers

The JSON request body has:

{
  "kind": "reseller#customer",
  "customerDomain": "example.com",
  "postalAddress": {
    "kind": "customers#address",
    "contactName": "John Doe",
    "organizationName": "Example Inc",
    "postalCode": "94043",
    "countryCode": "US",
  },
  "alternateEmail": "alternateEmail@google.com"
}

A successful response returns a HTTP 200 status code. Along with the status code, the JSON response returns the new customer's information:

{
  "kind": "reseller#customer",
  "customerId": "custId-1234",
  "customerDomain": "example.com",
  "postalAddress": {
    "kind": "customers#address",
    "contactName": "John Doe",
    "organizationName": "Example Inc",
    "postalCode": "94043",
    "countryCode": "US",
  },
  "alternateEmail": "alternateEmail@google.com"
}

Once the customer is created, create a user within the new customer's account. This first user should be immediately promoted to the super administrator role. When creating the administrator account, you may either generate a temporary random password or prompt the customer to provide a password. After the account has been created, you must notify the customer that they must sign-in to the Admin console and sign the G Suite via Reseller agreement in order to activate their account.

Retrieve a customer's account

This operation retrieves a customer's full account information, or the basic information of either a standalone Google customer or a customer registered with another reseller.

If the API returns an HTTP 404 response code, it can be assumed that the customer is new to Google and does not have an account, order a new customer account.

To retrieve a customer's account information, use the following GET HTTP request including the authorization token described in Authorizing requests. The customerId property is either the customer's primary domain name or the customer's unique identifier returned when retrieving a user's settings:

GET https://www.googleapis.com/apps/reseller/v1/customers/customerId

This example is retrieving the customer whose customerId is custId-1234:

GET https://www.googleapis.com/apps/reseller/v1/customers/custId-1234

You can also perform the request by utizing the customer's primary domain name as the customerId:

GET https://www.googleapis.com/apps/reseller/v1/customers/example.com

This operation has no properties in the request body.

A successful response returns a HTTP 200 status code. Along with the status code, the response returns the customer's information:

{
  "kind": "reseller#customer",
  "customerId": "custId-1234",
  "customerDomain": "example.com",
  "postalAddress": {
    "kind": "customers#address",
    "contactName": "John Doe",
    "organizationName": "Example Inc",
    "postalCode": "94043",
    "countryCode": "US",
  },
  "alternateEmail": "alternateEmail@google.com",
  "resourceUiUrl": "URL to customer's Admin console dashboard"
}

For customers that are presently managed either by Google or another reseller, the response only returns the customerId and customerDomain information.

{
  "kind": "reseller#customer",
  "customerId": "custId-1234",
  "customerDomain": "example.com"
}

Update a customer's settings

To update a customer's settings, use the following PUT HTTP request including the authorization token described in Authorizing requests. The customerId is either the customer's primary domain name or the customer's unique identifier returned when retrieving a resold customer's settings:

PUT https://www.googleapis.com/apps/reseller/v1/customers/customerId

This example updates the organizationName value for the customerId custId-1234.

PUT https://www.googleapis.com/apps/reseller/v1/customers/custId-1234

The JSON request body has:

{
  "kind": "reseller#customer",
  "customerId": "custId-1234",
  "customerDomain": "example.com",
  "postalAddress": {
    "kind": "customers#address",
    "contactName": "John Doe",
    "organizationName": "Example Inc Sales Group",
    "postalCode": "94043",
    "countryCode": "US",
  },
  "alternateEmail": "alternateEmail@google.com"
}

A successful JSON response returns a HTTP 200 status code. Along with the status code, the response returns the updated customer settings:

{
  "kind": "reseller#customer",
  "customerId": "custId-1234",
  "customerDomain": "example.com",
  "postalAddress": {
    "kind": "customers#address",
    "contactName": "John Doe",
    "organizationName": "Example Inc Sales Group",
    "postalCode": "94043",
    "countryCode": "US",
  },
  "alternateEmail": "alternateEmail@google.com"
}

Change a customer's default language

A newly created customer has a default language of English. To change the default language, use the PATCH or UPDATE calls from the Directory API Customers endpoint.

This example updates the default language value for the customerId custId-1234:

PATCH https://www.googleapis.com/admin/directory/v1/customers/custId-1234

The JSON request body has:

{
  "language":"es"
}

A successful JSON response returns a HTTP 200 status code. Along with the status code, the response returns the updated customer resource:

{
  "alternateEmail": "alternateEmail@google.com",
  "customerCreationTime": "2016-12-12T23:04:10.620Z",
  "customerDomain": "example.com",
  "id": "custId-1234",
  "kind": "admin#directory#customer",
  "language": "es",
  "postalAddress": {
    "contactName": "John Doe",
    "countryCode": "US",
    "organizationName": "Example Inc Sales Group",
    "postalCode": "94043"
  }
}

Error syntax

If a request is not successful, the API service's response returns an error. For a JSON response, the error syntax is:

{
  error: {
    errors: [
      {
        "domain": string,
        "reason": string,
        "message": string
      }
     ],
    "code": string,
    "message": string
 }
}

Send feedback about...

G Suite Reseller API
G Suite Reseller API