Account API


The Account API enables you to manage all SBS entities through API calls, just as you would through the Web user interface in the SBS Console. For example, you can create applications, tenants, or generate service access keys programmatically through API calls.

The Account API is the only SBS service that requires an Account Access Key (AAK). You can generate such a key from the SBS Console, see Generate an Account Access Key.

GraphQL access to the Account API is available either at the endpoint listed in the table below, or directly from the SBS Console. To access the GraphQL interface from the SBS Console:

  1. Sign in to the SBS Console.
  2. Click the GraphQL tab.

Access info

Endpoint https://account-api.socrate.io/graphql
Required access keys Account Access Key
Pricing Check the available purchase options.
Notes To call the service, the access key must be provided in the x-api-key header of the HTTP request. If you are using the GraphQL console, you can view the service’s documentation and schema only after entering an access key. Make sure that the scope of the key allows access to the queries and mutations that you require. For example, to grant the key access to all queries and mutations, the key’s scope must be set to account-api:query:* account-api:mutation:*.

Queries

account

Returns information about the account that you are currently using. This query may be useful if you have created multiple accounts from the SBS Console and would like to identify the one that you are currently using. In the SBS Console, the current account is the one shown at all times in the dropdown list in the top-right corner of the page. See also SBS accounts.

Arguments

None.

Result

Account type
Attribute Type Description
id ID The unique identifier of the account.
alias String The name (alias) of the account.
companyInfo CompanyInfo The details of the company that owns this SBS account.
onlineBankingEnabled Boolean Boolean flag that indicates whether online banking is enabled for this account.
onlineBankingBalanceInquiryMonthlyQuota Float Returns the number of monthly online banking balance inquiries allowed for this account. A null or zero value means unlimited balance inquiries are allowed.
onlineBankingTransactionsInquiryMonthlyQuota Float Returns the number of monthly online banking transaction inquiries allowed for this account. A null or zero value means unlimited transaction inquiries are allowed.
createdAt DateTime The date and time when the account was created.
CompanyInfo type
Attribute Type Description
name String The company name.
tin String The company’s tax identification number (TIN).
regNo String The company’s tax registration number.
country CountryCode Enum value that identifies the ISO 3166-2 two-letter country code.
billingAddress Address The company’s billing address information.
email EmailAddress The company’s primary email address.
phone String The company’s primary phone number.
Address type
Attribute Type Description
streetName String The street name.
number String The street number.
additionalAddressDetails String Any additional address details that don’t fit elsewhere.
building String The building identifier, if applicable.
city String The city.
postalCode String The postal code.
region String The region/county/province.
country CountryCode Enum value that identifies the ISO 3166-2 two-letter country code.

aggregatedUsage

Returns the total usage of SBS services for a particular time interval, grouped by service, usage measurement type (counter), tenant, and application. Unlike the usage query, which returns a per-date breakdown, this query returns a single total for each group. Because the service and type filter attributes are optional, one call can report the whole account’s consumption across every service and counter at once. Querying usage is meaningful only for those services that have usage measurement types (counters). To retrieve the list of services and their available counters, run the usageFilters query.

Arguments

Attribute Type Description
filter AggregatedUsageFilter! Mandatory. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the AggregatedUsageResult type.
limit Int Optional. The limit defines the maximum number of records that will be retrieved in the same call.
AggregatedUsageFilter type
Attribute Type Description
from DateTime! Mandatory. When provided, usage from with this date onward is returned.
to DateTime Optional. When provided, usage up to this date is returned.
service ServiceCode Optional. The service code specifies the service for which you would like to collect usage. To obtain all available service codes at application or tenant level, run the services query. The service code of the Account API is account-api. If omitted, the call returns totals for every service that recorded usage.
type TypeCode Optional. Specifies the usage type. Valid values depend on the service attribute. Run the usageFilters query to obtain usage measurement types applicable for each service. If omitted, the call returns totals for every counter of the selected services.
appId ID Optional. When an appId is specified, only usage for this app will be returned.
tenantId ID Optional. When a tenantId is specified, only usage for this tenant will be returned.
environment Environment Optional. An enum with the following valid values: TEST, PRODUCTION. If specified, only usage for this environment will be returned. This filter is meaningful only for services that have test and production environments.

A counter name is meaningful only within a service, so name the service whenever you name a counter. The call is rejected if you supply a type without a service, and also if you supply a type that is not a counter of the given service.

Result

The result is an object of type AggregatedUsageResult.

AggregatedUsageResult type
Attribute Type Description
items [AggregatedUsageValue] The array of AggregatedUsageValue objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.
AggregatedUsageValue type
Attribute Type Description
service ServiceCode The code of the service to which this total applies.
type TypeCode The usage measurement type (counter name) to which this total applies.
value Float The aggregated total of the counter within the requested period.
app App The app where usage applies.
tenant Tenant The tenant where usage applies.

Example

query aggregatedUsage($filter:AggregatedUsageFilter!,$nextToken:String,$limit:Int) {
  aggregatedUsage(filter:$filter,nextToken:$nextToken,limit:$limit){
    items {
      service
      type
      value
      app { id name }
      tenant { id name }
    }
    nextToken
  }
}

The following variables return the outbound invoice count of the Romanian e-Factura Service in the production environment:

{
  "filter": {
    "from": "2024-12-25",
    "service": "ro-efactura-api",
    "type": "OUTBOUND_INVOICES",
    "environment": "PRODUCTION"
  }
}

The following variables omit both service and type, and therefore return one total for each combination of service, counter, tenant, and application recorded since the given date:

{
  "filter": {
    "from": "2024-12-25"
  }
}

app

Returns information about the application ID supplied as input argument.

Arguments

Attribute Type Description
id ID! Mandatory. The unique identifier of the application.

Result

The result is an object of type App.

App type
Attribute Type Description
id ID The unique identifier of the app.
name String The name of the app.
active Boolean For future use.
createdAt DateTime The date and time when the app was created.
serviceAccessKeys ServiceAccessKey The list of tenant-level service access keys generated for this app.
appLevelServiceAccessKeys ServiceAccessKey The list of application-level service access keys generated for this app.
emailDomain String The email domain associated with this app. See also Register an email subdomain.
googleClientSecret GoogleClientSecret The OAuth 2.0 secrets generated from the Google Cloud Console for this app. See also Configure OAuth 2.0 for Google.
azureClientSecret AzureClientSecret The OAuth 2.0 secrets generated from the Microsoft Azure portal for this app. See also Configure OAuth 2.0 for Azure.
cognitoClientSecret CognitoClientSecret The OAuth 2.0 secrets generated from Amazon Cognito for this app.
roAnafEfacturaClientSecret RoAnafClientSecret The OAuth 2.0 secrets generated from the ANAF website for usage with E-Factura Service.
roAnafEfacturaAdditionalClientSecrets RoAnafClientSecret Additional OAuth 2.0 secrets generated from the ANAF website for usage with E-Factura Service.
roAnafEfacturaUseTestEnvironment Boolean Indicates whether the app’s environment is “test” or “production” for the purpose of E-Factura reporting. A true value indicates test environment.
roAnafEfacturaUseImplicitClientSecret Boolean Indicates whether your app is configured to use implicit (SBS-managed) ANAF client secrets, or custom client secrets. Valid values: true - your app uses SBS-managed client secrets for E-Factura; false or null - your app uses custom ANAF client secrets. See also Configure OAuth 2.0 for ANAF.
roAnafEfacturaMode EfacturaMode Indicates the E-Factura operating mode for this app. This is an enum with the following possible values: SEND_RECEIVE - the application can send and receive invoices, SEND_ONLY - the application can send invoices only; receiving is disabled. A newly created app starts in SEND_RECEIVE mode.
roAnafEtransportClientSecret RoAnafClientSecret The OAuth 2.0 secrets generated from the ANAF website for usage with E-Transport Service.
roAnafEtransportAdditionalClientSecrets RoAnafClientSecret Additional OAuth 2.0 secrets generated from the ANAF website for usage with E-Transport Service.
roAnafEtransportUseTestEnvironment Boolean Indicates whether the app’s environment is “test” or “production” for the purpose of E-Transport reporting. A true value indicates test environment.
roAnafEtransportUseImplicitClientSecret Boolean Indicates whether your app is configured to use implicit (SBS-managed) ANAF client secrets, or custom client secrets. Valid values: true - your app uses SBS-managed client secrets for E-Transport; false or null - your app uses custom ANAF client secrets. See also Configure OAuth 2.0 for ANAF.
roAnafEtransportMode EtransportMode Indicates the E-Transport operating mode for this app. This is an enum with the following possible values: DECLARER - the app allows callers to notify, modify, and delete E-Transport shipments as a declarer organization, CARRIER - the app allows callers to monitor and modify E-Transport shipments as a carrier organization, ALL - the app allows both modes above. A newly created app starts in ALL mode.
onlineBankingUseTestEnvironment Boolean Indicates whether the app’s environment is “test” or “production” for the purpose of online banking. A true value indicates test environment.
onlineBankingUseImplicitSettings Boolean Indicates whether your app is configured to use implicit online banking settings. Valid values: true - your app uses implicit settings for online banking; false or null - your app uses custom online banking settings as provided by the onlineBankingSettings property.
onlineBankingSettings OnlineBankingSettings This property defines custom online banking settings that are used if onlineBankingUseImplicitSettings is false.
emailIdentities [EmailIdentity] The email identities defined at application level. See also Verify an email identity at application level.
domainIdentities(filter: DomainIdentitiesFilter) [DomainIdentity] The domain identities defined at application level. See also Verify a domain identity at application level.
emailSenders [EmailAddress] The email addresses authorized to send email at application level.
webhooks(service: ServiceCode) [Webhook] The list of webhooks (automation settings) defined for the current application.
webhook(id: ID!) Webhook Returns the webhook with the given ID.
ServiceAccessKey type
Attribute Type Description
privateKey String The private (secret) part of the access key. This is a sensitive value that grants access to a particular service and should be stored securely. Note that the prefix of the key identifies whether it’s an application-level or tenant-level key. Specifically, application-level keys begin with app- while tenant-level keys begin with ten-.
publicKey String The public part of the access key.
appId ID The identifier of the app to which this key belongs.
app App The App object to which this key belongs.
tenantId ID The identifier of the tenant to which this key belongs. Applicable only if the current access key is a tenant-level access key.
tenant Tenant The Tenant object to which this key belongs. Applicable only if the current access key is a tenant-level access key.
active Boolean For future use.
description String The description of this access key.
scope Scope The scope defines the extent of permissions available to the bearer of this access key. See also Restrict access to services. NOTE: The access rights of a service access key are determined by the combination of role and scope attributes, see generateServiceAccessKey.
role ServiceAccessRole The role assigned to the key. NOTE: The access rights of a service access key are determined by the combination of role and scope attributes, see generateServiceAccessKey.
createdAt DateTime The date and time when the key was created.

 

Tenant type
Attribute Type Description
id ID The unique identifier of the tenant.
name String The tenant’s name.
active Boolean Specifies if the tenant is active. This field is for future use.
onlineBankingEnabled Boolean Boolean flag that indicates whether online banking is enabled for this tenant.
onlineBankingBalanceInquiryMonthlyQuota Float Returns the number of monthly online banking balance inquiries allowed for this tenant. A null or zero value means unlimited balance inquiries are allowed.
onlineBankingTransactionsInquiryMonthlyQuota Float Returns the number of monthly online banking transaction inquiries allowed for this tenant. A null or zero value means unlimited transaction inquiries are allowed.
createdAt DateTime The date and time when the tenant was created.
serviceAccessKeys [ServiceAccessKey] The array of ServiceAccessKey objects associated with this tenant.
serviceAccessDenials [ServiceAccessDenial] The array of ServiceAccessDenial objects associated with this tenant. See also Service Access Denials.
portalUsers [PortalUser] Returns a list of SBS Portal users that exist under this tenant.
webhooks [Webhook] The list of webhooks defined for this tenant.
ServiceAccessDenial type
Attribute Type Description
id ID The unique identifier of the service access denial.
tenantId ID The identifier of the tenant affected by this service access denial.
appId ID The identifier of the app affected by this service access denial.
app App The app details of of the app affected by this service access denial.
scope Scope The scope defines which queries and mutations are actually being denied.
reason String The message returned to the API caller which attempts to access a denied resource. This should be explanatory enough to avoid misunderstanding.
createdAt DateTime The date and time when the service access denial was created.
GoogleClientSecret type
Attribute Type Description
web GoogleClientSecretWeb This field groups together all secrets downloaded from the Google Cloud Console.
GoogleClientSecretWeb type
Attribute Type Description
client_id ID The ID of the OAuth 2.0 client as it appears in the Google Cloud Console.
project_id ID The project ID of the OAuth 2.0 client as it appears in the Google Cloud Console.
auth_uri String The authorization URI of the OAuth 2.0 client as it appears in the Google Cloud Console.
token_uri String The token URI of the OAuth 2.0 client as it appears in the Google Cloud Console.
auth_provider_x509_cert_url String The URL of the authorization provider’s certificate, as it appears in the Google Cloud Console.
client_secret String The client secret of the OAuth 2.0 client, as it appears in the Google Cloud Console.
redirect_uri Uri The redirect URI of the OAuth 2.0 client, as it appears in the Google Cloud Console.
javascript_origins [String] An array of HTTP origins that host your application, as they appear in the Google Cloud Console.
AzureClientSecret type
Attribute Type Description
web AzureClientSecretWeb This field groups together all secrets downloaded from the Azure Portal.
AzureClientSecretWeb type
Attribute Type Description
tenant_id ID The ID of the tenant as it appears in the Azure Portal.
application_id ID The ID of the application as it appears in the Azure Portal.
client_secret String The client secret of the OAuth 2.0 client, as it appears in the Azure Portal.
redirect_uri Uri The redirect URI of the OAuth 2.0 client, as it appears in the Azure Portal.
CognitoClientSecret type
Attribute Type Description
web CognitoClientSecretWeb This field groups together all application’s OAuth 2.0 secrets obtained from Amazon Cognito.
CognitoClientSecretWeb type
Attribute Type Description
userPoolId String! Mandatory. The ID of the Amazon Cognito User Pool.
clientId ID! Mandatory. The Client ID from Amazon Cognito.
RoAnafClientSecret type
Attribute Type Description
clientId String The ID of the OAuth 2.0 client generated on the ANAF portal.
clientSecret String The client secret of the OAuth 2.0 client generated on the ANAF portal. Note that, if roAnafEfacturaUseImplicitClientSecret or roAnafEtransportUseImplicitClientSecret is true, your app’s ANAF client secrets are managed by SBS, in which case this field will return a null value.
oauthCallback String The OAuth 2.0 callback URL generated on the ANAF portal.
OnlineBankingSettings type
Attribute Type Description
oauthCallback Uri A custom defined OAuth 2.0 callback URI. The user’s browser will be redirected to this URI after completing the online banking authorization process.
EmailIdentity type
Attribute Type Description
address String The email address intended for use in the “From” field when sending email through the Email Service.
status IdentityVerificationStatus The verification status for the email address. Valid values: VERIFIED, PENDING.
DomainIdentity type
Attribute Type Description
domain Domain The Internet domain, for example example.org.
status IdentityVerificationStatus Indicates the domain verification status. This is an enum with the following possible values: PENDING, VERIFIED, UNVERIFIED.
dnsRecords [DnsRecord] This property returns an array of records of type DnsRecord. All these records must be added to the domain’s zone records in order for the domain to become VERIFIED.
DnsRecord type
Attribute Type Description
type DnsRecordType Specifies the type of the DNS record. This is an enum with only one possible value: CNAME.
name String The DNS record name.
value String The DNS record value.
DomainIdentitiesFilter type
Attribute Type Description
status IdentityVerificationStatus Enables filtering domain identities by their verification status. This is an enum type with the following possible values: VERIFIED, PENDING.
Webhook type
Attribute Type Description
id ID The unique identifier of the webhook.
service ServiceCode The SBS service that triggers an automated event. To obtain all available service codes at application or tenant level, run the services query. The service code of the Account API is account-api.
tenant TenantEntry The tenant to which this webhook is scoped. When null, the webhook applies to all tenants of the app.
app AppEntry The app to which this webhook belongs.
url Uri The external URL to which SBS should submit data about the automated event.
accessKey String The API access key required by callers to post data to the URL above.
extraFields [KeyValue] Contains additional custom fields (as key-value pairs) that should be part of the webhook payload.
TenantEntry type
Attribute Type Description
id ID The unique identifier of the tenant.
name String The tenant’s name.
active Boolean Specifies if the tenant is active.
AppEntry type
Attribute Type Description
id ID The unique identifier of the app.
name String The name of the app.
KeyValue type
Attribute Type Description
key Key The key of the key-value pair.
value String The value of the key-value pair.

Example

query app($id:ID!,$domainIdentitiesFilter:DomainIdentitiesFilter){
  app(id:$id){
    id
    name
    domainIdentities(filter: $domainIdentitiesFilter) { domain status }
    emailSenders
  }
}
{
    "appId": "YOUR_APP_ID"
}

apps

Returns information about multiple applications. The filtering options are supplied as input argument.

Arguments

Attribute Type Description
filter AppsFilter Optional. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the AppsResult type.
AppsFilter type
Attribute Type Description
active Boolean Optional. When set to true, the result will include only active applications. NOTE: This field is reserved for future use.

Result

The result is an object of type AppsResult.

AppsResult type
Attribute Type Description
items [App] The array of App objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.

calls

Returns information about the API calls that took place for all SBS services. You can query, for example, how many times a particular query or mutation of a particular service was called within a given time period.

Arguments

Attribute Type Description
filter CallsFilter! Mandatory. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the CallsResult type.
limit Int Optional. The limit defines the maximum number of records that will be retrieved in the same call.
CallsFilter type
Attribute Type Description
from DateTime! Mandatory. The call will return data beginning with this date.
to DateTime Optional. When provided, only data up to this date are returned.
service ServiceCode! Mandatory. The service code specifies the service for which you would like to collect statistics. To obtain all available service codes at application or tenant level, run the services query. The service code of the Account API is account-api.
operationType OperationType! Mandatory. Specifies the operation type for which data should be returned. Valid values: query, mutation.
field Field Optional. Specifies the name of the query or mutation for which data should be returned.
result CallResult Optional Enables filtering calls by their outcome (success, error). Valid values: data, error.
appId ID Optional. If an appId is specified, only data for this app will be returned. It is meaningful to supply this value only if service requires an application-level access key.
tenantId ID Optional. If a tenantId is specified, only data for this tenant will be returned. It is meaningful to supply this value only if service requires a tenant-level access key.

Result

The result is an object of type CallsResult.

CallsResult type
Attribute Type Description
items [CallsValue] The array of CallsValue objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.
CallsValue type
Attribute Type Description
tenantId ID The ID of the tenant involved in this call.
appId ID The ID of the app involved in this call.
field Field The query or mutation involved in this call.
count Float Specifies the actual number of calls that took place, taking into account any filtering options that were set.
duration Float The call duration, in milliseconds.

portalUser

Returns an SBS Portal user by ID.

Arguments

Attribute Type Description
userId ID! Mandatory. The ID of the portal user to retrieve.

Result

The result is an object of type PortalUser.

portalUserInvitations

Returns the list of SBS portal user invitations pending for the current account.

Arguments

None.

Result

The result is an array of objects of type PortalUserInvitation.

portalUsers

Returns a list of SBS Portal users, along with their permissions.

Arguments

Attribute Type Description
filter PortalUsersFilter Optional. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the PortalUsersResult type.
PortalUsersFilter type
Attribute Type Description
provider Provider Optional. When provided, only users having this email provider will be returned in the results. Valid values: GOOGLE, MICROSOFT, SOCRATE.
email EmailAddress Optional. When provided, only the user with this email address is returned.

Result

The result is an object of type PortalUsersResult.

PortalUsersResult type
Attribute Type Description
items [PortalUser] The array of PortalUser objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.
PortalUser type
Attribute Type Description
userId ID The unique identifier of the portal user.
provider Provider The email provider of the portal user. Valid values: GOOGLE, MICROSOFT, SOCRATE.
email EmailAddress The email address of the portal user.
name String The name of the portal user.
picture Uri The URI of the picture associated with this portal user.
createdAt DateTime The date and time when this portal user was created.
permissions (tenantId: ID) [Permission] The list of permissions assigned to the portal user, as an array of Permission objects. Since permissions may be for different applications and tenants, you can optionally filter permissions by tenant, by supplying the tenantId argument to this field. This argument takes a specific tenant identifier; omit it to also see any wildcard tenant permission the user holds.
Permission type
Attribute Type Description
appId ID The unique identifier of the app to which the permission applies.
app App The object of type App to which the permission applies.
tenantId TenantId The unique identifier of the tenant to which the permission applies, or * if the permission applies to all tenants of the account.
tenant Tenant The object of type Tenant to which the permission applies. null when tenantId is *.
scope Scope The scope of the permission. For the syntax rules, see Restrict access to services.
roles [ServiceAccessRole] An array of roles granted to the bearer of this permission.
createdAt DateTime The date and time when the permission was created.

serviceAccessKeys

Returns the list of service access keys generated either at application level or at tenant-level (for a tenant-app combination). Each private key begins with a prefix that identifies the key type. If the private key is at the application level, it begins with app-. If the key is at the tenant level, it begins with ten-.

Arguments

Attribute Type Description
filter ServiceAccessKeysFilter Optional. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the ServiceAccessKeyResult type.
ServiceAccessKeysFilter type
Attribute Type Description
appId ID Optional. When provided, the query will return only keys that belong to this app.
tenantId ID Optional. When provided, the query will return only keys that belong to this tenant.
publicKey String Optional. When provided, the query will return only the service access key identified by this public key.

Result

ServiceAccessKeyResult type
Attribute Type Description
items [ServiceAccessKey] The array of ServiceAccessKey objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.

serviceAccessRoles

Returns the list of service access roles for the current account.

Arguments

None.

Result

The response is an array of ServiceAccessRole.

ServiceAccessRole type
Attribute Type Description
id ID The unique permanent identifier of the record.
name String The role name.
scope Scope The extent of permissions (scope) available to this role.
createdAt DateTime The date and time when the record was created.

servicePlans

Returns the service plans defined for the current account. A service plan applies to one combination of tenant, app, and service, and tells the consuming service which tier to apply to that combination. What a tier changes is each service’s own business; the Account API only records which plan applies. Only non-standard plans are recorded, so the result lists exceptions: a combination that the query does not return is on the STANDARD plan.

Arguments

Attribute Type Description
filter ServicePlansFilter Optional. Provides filtering options.
ServicePlansFilter type
Attribute Type Description
tenantId ID Optional. When provided, the query will return only the plans of this tenant.
appId ID Optional. When provided, the query will return only the plans of this app.
service ServiceCode Optional. When provided, the query will return only the plans that apply to this service.

Result

The result is an array of objects of type ServicePlan.

ServicePlan type
Attribute Type Description
tenant TenantEntry The tenant to which this plan applies.
app AppEntry The app to which this plan applies.
service ServiceCode The service to which this plan applies. To obtain all available service codes at tenant level, run the services query with accessLevel: TENANT.
plan PlanCode The plan that applies to this combination. Valid values: STANDARD, LIMITED.

Example

The following query retrieves every service plan defined for one app:

query servicePlans($filter:ServicePlansFilter) {
  servicePlans(filter:$filter) {
    tenant {
      id
      name
      active
    }
    app {
      id
      name
    }
    service
    plan
  }
}

With variables:

{
  "filter": {
    "appId": "YOUR_APP_ID"
  }
}

services

Returns a list of all services exposed by the Socrate Business Services API. This query is useful when you need to find out the service code of a particular service, for example, when setting permissions (scope) or querying usage.

Arguments

Attribute Type Description
accessLevel ServiceAccessLevel! Mandatory. Valid values: APP, TENANT. Use APP to retrieve services that require an application-level service access key. Use TENANT to retrieve services that require a tenant-level service access key.

Result

An array of service codes, for example:

{
  "data": {
    "services": [
      "oauth-api",
      "public-holidays-api",
      "user-management-api",
      "vat-validator-api"
    ]
  }
}

Example

The following query retrieves all service codes that require a tenant-level service access key:

query services($accessLevel:ServiceAccessLevel!) {
  services(accessLevel:$accessLevel) 
}

With variables:

{
  "accessLevel": "TENANT"
}

serviceSchemaFields

Returns the queries or the mutations published by the schema of a service, each with the description that the schema provides for it.

One use for the result is writing a scope string. A scope names the query or mutation it applies to, and this query supplies those names. For example, email-api:mutation:unsuppressAddress targets a single mutation of the Email Service.

Arguments

Attribute Type Description
service ServiceCode! Mandatory. The service whose schema is read. To obtain all available service codes at application or tenant level, run the services query.
operationType OperationType! Mandatory. Specifies the operation type for which fields should be returned. Valid values: query, mutation.

Result

The result is an array of objects of type ServiceSchemaField, one for each query or mutation of the requested operation type. Deprecated queries and mutations are excluded from the result. If the schema of the requested service cannot be read, the result is an empty array.

ServiceSchemaField type
Attribute Type Description
name String The name of the query or mutation. Use this value as the third part of a scope string, for example organizations-api:mutation:createOrganization. For more information, see Defining scope in GraphQL.
description String The description that the service schema provides for this query or mutation. Null if the schema documents no description for it.

Example

The following query retrieves the mutations of the Organizations Service:

query serviceSchemaFields($service:ServiceCode!, $operationType:OperationType!) {
  serviceSchemaFields(service:$service, operationType:$operationType) {
    name
    description
  }
}

With variables:

{
  "service": "organizations-api",
  "operationType": "mutation"
}

The result:

{
  "data": {
    "serviceSchemaFields": [
      {
        "name": "createOrganization",
        "description": "Creates an organization. Once an organization is created it can be referenced multiple times by different declarations."
      },
      {
        "name": "updateOrganization",
        "description": "Updates an organization."
      },
      {
        "name": "deleteOrganization",
        "description": "Delete an organization. Possible only if the organization is not referenced by any declaration."
      }
    ]
  }
}

tenant

Returns the tenant matching the ID supplied as input argument.

Arguments

Attribute Type Description
id ID Mandatory. The ID of the tenant to retrieve.

Result

The result is an object of type Tenant.

tenants

Returns the list of tenants matching the filter criteria. If no filter is specified, all tenants of the current account will be returned in the result.

Arguments

Attribute Type Description
filter TenantsFilter Optional. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the TenantsResult type.
TenantsFilter type
Attribute Type Description
active Boolean Optional. When provided, the query will return only active tenants. This field is currently for future use.
name String Optional. When provided, the query will return only tenants that match this name.

Result

The result is an array of objects of type TenantsResult.

TenantsResult type
Attribute Type Description
items [Tenant] The array of Tenant objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.

usage

Returns information about usage of SBS services. Querying usage is meaningful only for those services that have usage measurement types (counters). To retrieve the list of services and their available counters, run the usageFilters query.

Arguments

Attribute Type Description
filter UsageMeasurementFilter! Mandatory. Provides filtering options.
nextToken String Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the UsageMeasurementResult type.
limit Int Optional. The limit defines the maximum number of records that will be retrieved in the same call.
UsageMeasurementFilter type
Attribute Type Description
from DateTime! Mandatory. When provided, usage from with this date onward is returned.
to DateTime Optional. When provided, usage up to this date is returned.
service ServiceCode! Mandatory. The service code specifies the service for which you would like to collect usage. To obtain all available service codes at application or tenant level, run the services query. The service code of the Account API is account-api.
type TypeCode! Mandatory. Specifies the usage type. Valid values depend on the service argument. Run the usageFilters query to obtain usage measurement types applicable for each service.
appId ID Optional. When an appId is specified, only usage for this app will be returned.
tenantId ID Optional. When a tenantId is specified, only usage for this tenant will be returned.
environment Environment Optional. An enum with the following valid values: TEST, PRODUCTION. If specified, only usage for this environment will be returned. This filter is meaningful only for services that have test and production environments.

Result

The result is an object of type UsageMeasurementResult.

UsageMeasurementResult type
Attribute Type Description
items [MeasurementValue] The array of MeasurementValue objects that match the filter criteria.
nextToken String If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results.
MeasurementValue type
Attribute Type Description
value String The usage value.
date Date The date on which usage occurred.
app App The app where usage applies.
tenant Tenant The tenant where usage applies.

usageFilters

Returns the usage measurement types (or “counters”) available for each service when you run the usage or aggregatedUsage query. It also returns the filters that apply to and are meaningful for the service supplied as input.

Arguments

Attribute Type Description
service ServiceCode Optional. The code of the service for which you would like to obtain information. You can obtain the service code of each service by running the services query. If you don’t supply this parameter, the query returns information for all services.

Result

The result is an array of objects of UsageFilters type.

UsageFilters type
Attribute Type Description
service ServiceCode The service code for which information is being returned.
types [TypeCode] The usage type applicable to the service indicated by service.
appId Boolean Returns true if this service is filterable by an appId, false otherwise.
tenantId Boolean Returns true if this service is filterable by a tenantId, false otherwise.
environment Boolean Returns true if this service is filterable by an environment, false otherwise.

Example

The following call retrieves information for all services (note that no parameters are supplied):

query UsageFilters($service:ServiceCode) {
  usageFilters(service:$service) {
    service
    types
    appId
    tenantId
    environment
  }
}

The following call retrieves information for the Romanian e-Factura Service:

query UsageFilters($service:ServiceCode) {
  usageFilters(service:$service) {
    service
    types
    appId
    tenantId
    environment
  }
}
{
  "service": "ro-efactura-api"
}

version

Returns the API version.

Mutations

addEmailSender

Adds an email address to the list of authorized email senders for this app. Note that you can add an email sender only if the domain of the email address is a domain identity that was created through the verifyDomainIdentity mutation.

Arguments

Attribute Type Description
appId ID! Mandatory. The ID of the app where the authorized email sender is to be added.
address EmailAddress! Mandatory. The authorized email address to be added.

Result

The result of this mutation is an email address of type EmailAddress.

Example

mutation AddEmailSender($appId:ID!,$address:EmailAddress!) {
  addEmailSender(appId:$appId,address:$address)
}
{
    "appId": "YOUR_APP_ID",
    "address": "jane.doe@example.org"
}

addWebhook

Adds a webhook to an application.

Arguments

Attribute Type Description
appId ID! Mandatory. The ID of the application to which the webhook is being added.
service ServiceCode! Mandatory. The SBS service that triggers the webhook. To obtain all available service codes at application or tenant level, run the services query.
tenantId ID Optional. When provided, the webhook applies only to the specified tenant.
input WebhookInput! Mandatory. Provides input data to the mutation.
WebhookInput type
Attribute Type Description
url Uri! Mandatory. The URI to which the webhook data should be submitted.
accessKey String! Mandatory. The API access key required by callers to post data to the URL above.
extraFields [KeyValueInput]
KeyValueInput type
Attribute Type Description
key Key! Mandatory. The key name. Accepts valid JSON field names, excluding reserved webhook fields: service, event, tenantId, payload.
value String Optional. The key value.

Result

See the Webhook type.

createApp

Creates a new application.

Arguments

Attribute Type Description
input CreateAppInput! Mandatory. Provides input data to the mutation.
CreateAppInput type
Attribute Type Description
name String! Mandatory. The name of the app to be created. The app name must be unique within the boundaries of the account.

Result

See the App type.

createServiceAccessRole

Creates a new role.

Arguments

Attribute Type Description
input CreateServiceAccessRoleInput! Mandatory. Provides input data to the mutation.
CreateServiceAccessRoleInput type
Attribute Type Description
name String! Mandatory. The name of the role to be created.
scope Scope! Mandatory. The extent of permissions (scope) available to this role. For example, to grant to the role read-only access to the Email Service, enter email-api:query:*. For more information, see Defining scope in GraphQL.

Result

See the ServiceAccessRole type.

createTenant

Creates a new tenant.

Arguments

Attribute Type Description
input CreateTenantInput! Mandatory. Provides input data to the mutation.
CreateTenantInput type
Attribute Type Description
name String! Mandatory. The name of the tenant to be created. The tenant name must be unique within the boundaries of the account.

Result

See the Tenant type.

deleteAppLevelServiceAccessKey

Deletes an application-level service access key.

Arguments

Attribute Type Description
input DeleteAppLevelServiceAccessKeyInput! Mandatory. Provides input data to the mutation.
DeleteAppLevelServiceAccessKeyInput type
Attribute Type Description
appId ID! Mandatory. The identifier of the app where the service access key is applicable.
publicKey String! Mandatory. The public key of the service access key.

Result

See the ServiceAccessKey type.

deleteDomainIdentity

Deletes a domain identity.

Arguments

Attribute Type Description
appId ID! Mandatory. The identifier of the app from which the domain identity is being deleted.
domain Domain! Mandatory. The Internet domain of the identity to be deleted.

Result

See the DomainIdentity.

Example

mutation DeleteDomainIdentity($appId:ID!,$domain:Domain!) {
  deleteDomainIdentity(appId:$appId, domain:$domain) {
    domain
    status
    dnsRecords { type name value }
  }
}
{
    "appId": "YOUR_APP_ID",
    "domain": "example.org"
}

deleteEmailIdentity

Deletes an email identity.

Arguments

Attribute Type Description
appId ID! Mandatory. The identifier of the app from which the email identity is being deleted.
address EmailAddress! Mandatory. The email address to be deleted.

Result

See the EmailIdentity.

deleteServiceAccessKey

Deletes a service access key.

Arguments

Attribute Type Description
input DeleteServiceAccessKeyInput! Mandatory. Provides input data to the mutation.
DeleteServiceAccessKeyInput type
Attribute Type Description
appId ID! Mandatory. The identifier of the app where the service access key is applicable.
tenantId ID! Mandatory. The identifier of the tenant where the service access key is applicable.
publicKey String! Mandatory. The public key of the service access key.

Result

See the ServiceAccessKey type.

Example

The code listing below illustrates how to delete a service access key.

mutation DeleteTenantKey($input: DeleteServiceAccessKeyInput!) {
  deleteServiceAccessKey(input: $input){
    publicKey
    # privateKey
    scope
  }
}
{
    "input": {
        "appId": "YOUR_APPLICATION_ID",
        "tenantId": "YOUR_TENANT_ID",
        "publicKey": "YOUR_PUBLIC_KEY",
    }
}

deleteServiceAccessRole

Deletes an existing role.

Arguments

Attribute Type Description
id ID! Mandatory. The ID of the role to be deleted.

Result

See the ServiceAccessRole type.

deleteWebhook

Arguments

Attribute Type Description
appId ID! Mandatory. The ID of the application from which the webhook is being deleted.
id ID! Mandatory. The unique identifier of the webhook to be deleted.

Result

See the Webhook type.

denyServiceAccess

A service access denial prevents a tenant from executing the designated set of queries and mutations. This is a quick way to temporarily block only a very specific resource without modifying the tenant’s service access key. You can revoke existing denials using the revokeServiceAccessDenial mutation. See also Service Access Denials.

Arguments

Attribute Type Description
input DenyServiceAccessInput! Mandatory. Provides input data to the mutation.
DenyServiceAccessInput type
Attribute Type Description
tenantId ID! The ID of the tenant whose access to the resource must be blocked.
appId ID! The ID of the app where the denial is active.
scope Scope! The list of queries and/or mutations that must be blocked. For example, the scope email-api:mutation:sendMessage will prevent the tenant from being able to call the sendMessage mutation of the Email Service. For syntax details, see Restrict access to services.
reason String! The message that should appear to the API caller when they attempt to access the blocked resource.

Result

See the ServiceAccessDenial type.

generateAppLevelServiceAccessKey

Generates a service access key at application level. See also Generate an application-level service access key.

Arguments

Attribute Type Description
input GenerateAppLevelServiceAccessKeyInput! Mandatory. Provides input data to the mutation.
GenerateAppLevelServiceAccessKeyInput type
Attribute Type Description
appId ID! Mandatory. The identifier of the app where the service access key is applicable.
active Boolean Optional, for future use.
description String Optional. Provides a description for the generated key.
scope Scope Optional. Defines the extent of permissions available to the bearer of the key. For syntax details, see Restrict access to services.

Result

See the ServiceAccessKey type.

generateServiceAccessKey

Generates a tenant-level service access key. See also Generate a service access key.

Arguments

Attribute Type Description
input GenerateServiceAccessKeyInput! Mandatory. Provides input data to the mutation.
GenerateServiceAccessKeyInput type
Attribute Type Description
appId ID! Mandatory. The identifier of the app where the service access key is applicable.
tenantId ID! Mandatory. The identifier of the tenant where the service access key is applicable.
active Boolean Optional, for future use.
description String Optional. Provides a description for the generated key.
scope Scope Optional. Sets the extent of permissions available to the bearer of the key. For syntax details, see Restrict access to services.
roleId ID Optional. Assigns a role to the key.

Result

See the ServiceAccessKey type.

Example

The code listing below illustrates how to create a service access key with full access rights to the email-api. This permission is provided by the scope attribute.

mutation generate_sak($appId: ID!, $tenantId: ID!, $active: Boolean, $description: String, $scope: Scope) {
  generateServiceAccessKey(
    input: {appId: $appId, tenantId: $tenantId, active: $active, description: $description, scope: $scope}
  ) {
    privateKey
  }
}
{
  "appId": "YOUR_APPLICATION_ID",
  "tenantId": "YOUR_TENANT_ID",
  "description": "",
  "scope": "email-api:query:* email-api:mutation:*"
}

In the variables, make sure to replace the example values below with the ones you actually require:

  • appId - The unique identifier of the application for which you are generating this key. To view all applications and their details, run the apps query first.
  • tenantId - The unique identifier of the tenant for which you are generating this key. To view all tenants and their details, run the tenants query first.
  • roleId - Optional parameter, not used in this example. If given, this should be the ID of a role created through createServiceAccessRole.
  • scope - Optional parameter. If provided, it restricts the scope of the key to specific services only, or to even to specific queries and mutations of a service. In this example, the scope provides full access to all queries and all mutations of the Email Service. For more information about the syntax rules, see Restrict access to services.
  • description - An optional text description that will help you easier identify the key later.

The privateKey field in the returned response contains the generated key.

invitePortalUser

Sends an invitation to the email address supplied as input. If the user accepts the invitation, they will be added as a new user with access to the SBS Portal.

Arguments

Attribute Type Description
input InvitePortalUserInput! Mandatory. Provides input data to the mutation.
InvitePortalUserInput type
Attribute Type Description
provider Provider Optional. If you specify a provider, the user will be able to complete the invitation and become an SBS Portal user only if their email address is from that provider. Valid values: GOOGLE, MICROSOFT, SOCRATE.
email EmailAddress! Mandatory. Specifies the email address of the user to be invited.
permissions [PermissionInput]! Mandatory. Specifies the extent of permissions available to the new user. Since a user may need access to multiple SBS apps and tenants, multiple permission sets can be assigned, one for each app-tenant combination. See PermissionInput.
message String Optional. A custom text message to be included in the invitation email.

Result

PortalUserInvitationType type
Attribute Type Description
id ID The unique identifier of the invitation.
provider Provider The identifier of the email provider specified when running the invitePortalUser mutation. Possible values: GOOGLE, MICROSOFT, SOCRATE.
email EmailAddress The email address associated with the invitation.
permissions [PortalUserInvitationPermission] The array of permissions assigned to the portal user. Each array item is of type PortalUserInvitationPermission.
PortalUserInvitationPermission type
Attribute Type Description
appId ID The unique identifier of the app where scope applies.
tenantId TenantId The unique identifier of the tenant where scope applies, or * if scope applies to all tenants of the account.
scope Scope The actual scope (extent of permissions) available to the user for this app and tenant combination. See Defining scope in GraphQL.
roles [ServiceAccessRole] An array containing roles that are granted to the bearer of this permission.

Example

The following mutation invites a user and grants them read and write access to the Romanian e-Factura Service and the Romanian ANAF Authorizations Service, for one app and tenant:

mutation invitePortalUser($input: InvitePortalUserInput!) {
  invitePortalUser(input: $input) {
    id
    provider
    email
    permissions {
      appId
      tenantId
      scope
    }
  }
}

With variables:

{
  "input": {
    "email": "jane.doe@example.com",
    "permissions": [
      {
        "appId": "YOUR_APP_ID",
        "tenantId": "YOUR_TENANT_ID",
        "scope": "ro-efactura-api:query:* ro-efactura-api:mutation:* ro-anaf-oauth-api:query:* ro-anaf-oauth-api:mutation:*"
      }
    ]
  }
}

To grant the same access across every tenant of the account, set tenantId to *. See Wildcard tenant permissions.

registerAppSubdomain

This mutation is useful if you would like to configure your application to receive email at some specified address. The email subdomain registered via this query becomes part of the email address at which you can receive email.

Arguments

Attribute Type Description
input RegisterAppSubdomainInput! Mandatory. Provides input data to the mutation.
RegisterAppSubdomainInput type
Attribute Type Description
appId ID! Mandatory. The identifier of the app for which you are registering the email subdomain.
subdomain String! Mandatory. The actual email subdomain to be registered.

Result

AppSubDomain type
Attribute Type Description
appId ID The identifier of the application whose email subdomain was registered.
subdomain String The email subdomain that was registered.
emailDomain String This string identifies the part of the email after the “@” character, excluding the tenant’s subdomain. The tenant’s subdomain must be registered through the registerSubdomain mutation of the Email Service individually for each tenant.

removeEmailSender

Removes an email address from the list of authorized email senders for this app.

Arguments

Attribute Type Description
appId ID! Mandatory. The ID of the app from where the authorized email sender is to be removed.
address EmailAddress! Mandatory. The authorized email address to be removed.

Result

The result of this mutation is an email address of type EmailAddress.

Example

mutation RemoveEmailSender($appId:ID!,$address:EmailAddress!) {
 removeEmailSender(appId:$appId,address:$address) 
}
{
    "appId": "{{appId}}",
    "address": "jane.doe@example.org"
}

removePortalUser

Deletes a portal user.

Arguments

Attribute Type Description
userId ID! Mandatory. The ID of the portal user to be deleted.

Result

See the PortalUser type.

Example

mutation removePortalUser($userId: ID!) {
  removePortalUser(userId: $userId) {
    userId
    provider
    email
    name
    createdAt
  }
}

With variables:

{
  "userId": "YOUR_PORTAL_USER_ID"
}

removePortalUserInvitation

Removes a pending SBS Portal user invitation.

Arguments

Attribute Type Description
id ID! Mandatory. The ID of the pending portal user invitation.

Result

See the PortalUserInvitation type.

removePortalUserPermission

Removes permissions previously granted to a portal user.

Arguments

Attribute Type Description
userId ID! Mandatory. The ID of the portal user whose permissions must be removed.
permissionKey PermissionKeyInput! Mandatory. A permission key defines the unique app-tenant combination that was specified when creating the permission.
PermissionKeyInput type
Attribute Type Description
appId ID! Mandatory. Specifies the identifier of the app where permissions are applicable.
tenantId TenantId Optional. Specifies the identifier of the tenant where permissions are applicable. Pass * to remove a permission that applies to all tenants of the account.

Result

See the PortalUser type.

Example

The following mutation removes the permission that a portal user holds for one app and tenant combination:

mutation removePortalUserPermission($userId: ID!, $permissionKey: PermissionKeyInput!) {
  removePortalUserPermission(userId: $userId, permissionKey: $permissionKey) {
    userId
    provider
    email
    name
    picture
    createdAt
    permissions {
      appId
      app { name }
      tenantId
      tenant { name }
      scope
      createdAt
    }
  }
}

With variables:

{
  "userId": "YOUR_PORTAL_USER_ID",
  "permissionKey": {
    "appId": "YOUR_APP_ID",
    "tenantId": "YOUR_TENANT_ID"
  }
}

To remove a permission that applies to every tenant of the account, set tenantId to *. See Wildcard tenant permissions.

revokeServiceAccessDenial

Revokes (deletes) a service access denial that is in effect for a given tenant/app combination. This mutation is the reverse of the denyServiceAccess mutation.

Arguments

Attribute Type Description
input RevokeServiceAccessDenialInput! Mandatory. Provides input data to the mutation.
RevokeServiceAccessDenialInput type
Attribute Type Description
tenantId ID! Mandatory. The ID of the tenant where the service access denial applies.
appId ID! Mandatory. The ID of the app where the service access denial applies.
denialId ID! Mandatory. The ID of the service access denial record.

Result

See the ServiceAccessDenial type.

setPortalUserPermission

Grants a portal user a permission for an app and tenant combination. If the portal user already holds a permission for that combination, the values you supply replace the existing ones; a scope or roles value you omit is left unchanged.

Arguments

Attribute Type Description
userId ID! Mandatory. The ID of the portal user whose permissions are to be updated.
permission PermissionInput! Mandatory. Defines the extent of permissions granted to the portal user.
PermissionInput type
Attribute Type Description
appId ID! Mandatory. Identifies the app where permissions are applicable.
tenantId TenantId! Mandatory. Identifies the tenant where permissions are applicable. Pass * to grant the permission across all tenants of the account.
scope Scope Optional. Specifies the actual extent of permissions granted. For example, to grant the user permissions to view all email for the given app and tenant but not modify it, enter email-api:query:*. For more information, see Defining scope in GraphQL.
roles [ID] An array containing IDs of existing roles that should be granted to the bearer of this permission.

Result

See the PortalUser type.

Example

The following mutation grants a portal user access to all queries and mutations of the Email Service and the File Management Service, for one app and tenant:

mutation setPortalUserPermission($userId: ID!, $permission: PermissionInput!) {
  setPortalUserPermission(userId: $userId, permission: $permission) {
    userId
    provider
    email
    name
    picture
    createdAt
    permissions {
      appId
      app { name }
      tenantId
      tenant { name }
      scope
      createdAt
    }
  }
}

With variables:

{
  "userId": "YOUR_PORTAL_USER_ID",
  "permission": {
    "appId": "YOUR_APP_ID",
    "tenantId": "YOUR_TENANT_ID",
    "scope": "email-api:query:* email-api:mutation:* file-management-api:query:* file-management-api:mutation:*"
  }
}

To grant the same access across every tenant of the account, set tenantId to *. The returned permission then carries tenantId * and a tenant of null. See Wildcard tenant permissions.

setServicePlan

Assigns a service plan to a combination of tenant, app, and service. If the combination already has a plan, its plan code is replaced. Because only non-standard plans are recorded, setting the plan to STANDARD returns the combination to the standard plan and has the same effect as unsetServicePlan.

Arguments

Attribute Type Description
input ServicePlanInput! Mandatory. Identifies the combination and the plan.
ServicePlanInput type
Attribute Type Description
tenantId ID! Mandatory. The ID of the tenant to which the plan applies. The tenant must belong to the current account.
appId ID! Mandatory. The ID of the app to which the plan applies. The app must belong to the current account.
service ServiceCode! Mandatory. The service to which the plan applies. Only services that accept a tenant-level service access key are valid here. To obtain them, run the services query with accessLevel: TENANT.
plan PlanCode! Mandatory. Valid values: STANDARD, LIMITED.

Result

See the ServicePlan type.

Example

The following mutation places one tenant on the limited plan for a given app and service:

mutation setServicePlan($input:ServicePlanInput!) {
  setServicePlan(input:$input) {
    tenant {
      id
      name
    }
    app {
      id
      name
    }
    service
    plan
  }
}

With variables:

{
  "input": {
    "tenantId": "YOUR_TENANT_ID",
    "appId": "YOUR_APP_ID",
    "service": "ro-efactura-api",
    "plan": "LIMITED"
  }
}

unsetServicePlan

Returns a combination of tenant, app, and service to the STANDARD plan by removing the plan recorded for it. Calling the mutation for a combination that has no recorded plan succeeds and changes nothing.

Arguments

Attribute Type Description
input ServicePlanKeyInput! Mandatory. Identifies the combination.
ServicePlanKeyInput type
Attribute Type Description
tenantId ID! Mandatory. The ID of the tenant whose plan is removed. The tenant must belong to the current account.
appId ID! Mandatory. The ID of the app whose plan is removed. The app must belong to the current account.
service ServiceCode! Mandatory. The service whose plan is removed. Only services that accept a tenant-level service access key are valid here. To obtain them, run the services query with accessLevel: TENANT.

Result

Returns true when the call succeeds.

Example

The following mutation returns a combination to the standard plan:

mutation unsetServicePlan($input:ServicePlanKeyInput!) {
  unsetServicePlan(input:$input)
}

With variables:

{
  "input": {
    "tenantId": "YOUR_TENANT_ID",
    "appId": "YOUR_APP_ID",
    "service": "ro-efactura-api"
  }
}

updateApp

Updates an application’s details (such as name or OAuth 2.0 secrets).

Arguments

Attribute Type Description
id ID! Mandatory. The ID of the application to be updated.
input UpdateAppInput! Mandatory. Provides input data to the mutation.
UpdateAppInput type
Attribute Type Description
name String Optional. Specifies the new name of the app.
active Boolean Optional, for future use. Activates or deactivates the app.
googleClientSecret GoogleClientSecretInput Optional. Provides input data used to update the application’s Google OAuth 2.0 secrets.
azureClientSecret AzureClientSecretInput Optional. Provides input data used to update the application’s Azure OAuth 2.0 secrets.
cognitoClientSecret CognitoClientSecretInput Optional. Provides input data used to update the application’s Cognito OAuth 2.0 secrets.
roAnafEfacturaClientSecret RoAnafClientSecretInput Optional. Provides input data used to update the application’s ANAF OAuth 2.0 secrets used to authorize E-Factura calls. You do not need to supply a value for this field if roAnafEfacturaUseImplicitClientSecret is true.
roAnafEfacturaAdditionalClientSecrets RoAnafClientSecretInput Optional. Used when you need multiple callback URLs for ANAF OAuth 2.0 authorization. See Managing additional ANAF OAuth 2.0 secrets.
roAnafEfacturaUseTestEnvironment Boolean Optional. Set this option to true if the app should use the RO ANAF test environment instead of production, for the purpose of E-Factura reporting.
roAnafEfacturaUseImplicitClientSecret Boolean Optional. Set this option to true if your app should use implicit (SBS-managed) ANAF client secrets for E-Factura reporting. See also Configure OAuth 2.0 for ANAF.
roAnafEfacturaMode EfacturaMode Optional. Sets the E-Factura operating mode for this app. Possible values: SEND_RECEIVE - the application can send and receive invoices, SEND_ONLY - the application can send invoices only; receiving is disabled. A null value has the same effect as SEND_RECEIVE, for backward compatibility.
roAnafEtransportClientSecret RoAnafClientSecretInput Optional. Provides input data used to update the application’s ANAF OAuth 2.0 secrets used to authorize E-Transport calls. You do not need to supply a value for this field if roAnafEtransportUseImplicitClientSecret is true.
roAnafEtransportAdditionalClientSecrets RoAnafClientSecretInput Optional. Used when you need multiple callback URLs for ANAF OAuth 2.0 authorization. See Managing additional ANAF OAuth 2.0 clients.
roAnafEtransportUseTestEnvironment Boolean Optional. Set this option to true if the app should use the RO ANAF test environment instead of production, for the purpose of E-Transport reporting.
roAnafEtransportUseImplicitClientSecret Boolean Optional. Set this option to true if your app should use implicit (SBS-managed) ANAF client secrets for E-Transport reporting. See also Configure OAuth 2.0 for ANAF.
roAnafEtransportMode EtransportMode Optional. Sets the E-Transport operating mode for this app. Possible values: DECLARER - the app allows callers to notify, modify, and delete E-Transport shipments as a declarer organization, CARRIER - the app allows callers to monitor and modify E-Transport shipments as a carrier organization, ALL - the app allows both modes above. A null value has the same effect as ALL.
onlineBankingUseTestEnvironment Boolean Optional. Set this option to true if your app should use the test environment for online banking.
onlineBankingUseImplicitSettings Boolean Optional. Set this option to true if your app should use implicit (default) online banking settings. A false value means the app will use custom online banking settings, as defined through the onlineBankingSettings input.
onlineBankingSettings OnlineBankingSettingsInput Conditional. This property defines custom online banking settings. It is mandatory if onlineBankingUseImplicitSettings is false.
GoogleClientSecretInput type
Attribute Type Description
web GoogleClientSecretWebInput This field groups together all application’s OAuth 2.0 secrets downloaded from the Google Cloud Console.
GoogleClientSecretWebInput type
Attribute Type Description
client_id ID! Mandatory. The ID of the OAuth 2.0 client as it appears in the Google Cloud Console.
project_id ID Optional. The project ID of the OAuth 2.0 client as it appears in the Google Cloud Console.
auth_uri String! Mandatory. The authorization URI of the OAuth 2.0 client as it appears in the Google Cloud Console.
token_uri String! Mandatory. The token URI of the OAuth 2.0 client as it appears in the Google Cloud Console.
auth_provider_x509_cert_url String! Mandatory. The URL of the authorization provider’s certificate, as it appears in the Google Cloud Console.
client_secret String! Mandatory. The client secret of the OAuth 2.0 client, as it appears in the Google Cloud Console.
redirect_uri Uri Optional. The redirect URI of the OAuth 2.0 client, as it appears in the Google Cloud Console.
javascript_origins [String] Optional. An array of HTTP origins that host your application, as they appear in the Google Cloud Console.
AzureClientSecretInput type
Attribute Type Description
web AzureClientSecretWebInput This field groups together all application’s OAuth 2.0 secrets downloaded from the Azure portal.
AzureClientSecretWebInput type
Attribute Type Description
application_id ID! Mandatory. The ID of the application as it appears in the Azure Portal.
tenant_id ID Optional. The ID of the tenant as it appears in the Azure Portal.
client_secret String Optional. The client secret of the OAuth 2.0 client, as it appears in the Azure Portal.
redirect_uri Uri Optional. The redirect URI of the OAuth 2.0 client, as it appears in the Azure Portal.
CognitoClientSecretInput type
Attribute Type Description
web CognitoClientSecretWebInput This field groups together all application’s OAuth 2.0 secrets obtained from Amazon Cognito.
CognitoClientSecretWebInput type
Attribute Type Description
userPoolId String! Mandatory. The ID of the Amazon Cognito User Pool.
clientId ID! Mandatory. The Client ID from Amazon Cognito.
RoAnafClientSecretInput type

This type has the same structure as the RoAnafClientSecret type.

OnlineBankingSettingsInput type
Attribute Type Description
oauthCallback Uri! A custom defined OAuth 2.0 callback URI. The user’s browser will be redirected to this URI after completing the online banking authorization process.

Result

See the App type.

updateCompanyInfo

Updates the company information of the company that owns the current SBS account.

Arguments

Attribute Type Description
input CompanyInfoInput The company data to be updated.
CompanyInfoInput type
Attribute Type Description
name String! The company name.
tin String The company’s tax identification number (TIN).
regNo String! The company’s tax registration number.
country CountryCode! Enum value that identifies the ISO 3166-2 two-letter country code.
billingAddress AddressInput! The company’s billing address information.
email EmailAddress! The company’s primary email address.
phone String The company’s primary phone number.
AddressInput type
Attribute Type Description
streetName String! The street name.
number String! The street number.
additionalAddressDetails String Any additional address details that don’t fit elsewhere.
building String The building identifier, if applicable.
city String! The city.
postalCode String The postal code.
region String! The region/county/province.
country CountryCode! Enum value that identifies the ISO 3166-2 two-letter country code.

Result

See the CompanyInfo type.

updateServiceAccessRole

Updates an existing role.

Arguments

Attribute Type Description
id ID! Mandatory. The ID of the role to be updated.
input UpdateServiceAccessRoleInput! Mandatory. Provides input data to the mutation.
UpdateServiceAccessRoleInput type
Attribute Type Description
name String Optional. The name of the role to be updated.
scope Scope Optional. The extent of permissions (scope) available to this role. For example, to grant to the role read-only access to the Email Service, enter email-api:query:*. For more information, see Defining scope in GraphQL.

Result

See the ServiceAccessRole type.

updateServiceAccessKey

Updates a tenant-level service access key.

Arguments

Attribute Type Description
input UpdateServiceAccessKeyInput! Mandatory. Provides input data to the mutation.
UpdateServiceAccessKeyInput type

You can update the following fields of a service access key:

  • active
  • description
  • scope
  • roleId

The mandatory fields appId, tenantId, and publicKey are used for identifying the key and cannot be updated.

Attribute Type Description
appId ID! Mandatory. The identifier of the app where the service access key is applicable.
tenantId ID! Mandatory. The identifier of the tenant where the service access key is applicable.
publicKey String! Mandatory. The public key of the service access key.
active Boolean Optional, for future use.
description String Optional. Provides a description for the generated key.
scope Scope Optional. Defines the extent of permissions available to the bearer of the key. For syntax details, see Restrict access to services.
roleId ID Optional. Assigns a role to the key.

Result

See the ServiceAccessKey type.

Example

The code listing below illustrates how to update a service access key so as to grant to it full access to the Email Service, through the scope attribute.

mutation UpdateKey($input: UpdateServiceAccessKeyInput!) {
    updateServiceAccessKey(input: $input) {
          appId
          app { name }
          tenantId
          tenant { name }
          active
          description
          scope
          role { id name scope createdAt }
          createdAt
    }
}
{
    "input": {
        "appId": "YOUR_APPLICATION_ID",
        "tenantId": "YOUR_TENANT_ID",
        "publicKey": "YOUR_PUBLIC_KEY",
        "scope": "email-api:query:* email-api:mutation:*"
    }
}

In the variables, make sure to replace the example values below with the ones you actually require:

  • appId - The unique identifier of the application for which you are generating this key. To view all applications and their details, run the apps query first.
  • tenantId - The unique identifier of the tenant for which you are generating this key. To view all tenants and their details, run the tenants query first.
  • publicKey - The identifier of the key you are updating (the public key).
  • roleId - Optional parameter, not used in this example. If given, this should be the ID of a role created through createServiceAccessRole.
  • scope - Optional parameter. If provided, it restricts the scope of the key to specific services only, or to even to specific queries and mutations of a service. In this example, the scope provides full access to all queries and all mutations of the Email Service. For more information about the syntax rules, see Restrict access to services.
  • description - An optional text description that will help you easier identify the key later.

updateTenant

Arguments

Attribute Type Description
id ID! Mandatory. Specifies the ID of the tenant to be updated.
input UpdateTenantInput! Mandatory. Provides input data to the mutation.
UpdateTenantInput type
Attribute Type Description
name String Optional. Specifies the new tenant name.
active Boolean Optional, for future use. Activates or deactivates the tenant.
onlineBankingEnabled Boolean Optional. Set this value to true to enable online banking for this tenant. Set it to false to disable online banking.
onlineBankingBalanceInquiryMonthlyQuota Float Optional. Sets the number of monthly online banking balance inquiries allowed for this tenant. A null or zero value means unlimited balance inquiries are allowed.
onlineBankingTransactionsInquiryMonthlyQuota Float Optional. Sets the number of monthly online banking transaction inquiries allowed for this tenant. A null or zero value means unlimited transaction inquiries are allowed.

Result

See the Tenant type.

updateWebhook

Arguments

Attribute Type Description
appId ID! Mandatory. The ID of the application to which the webhook belongs.
id ID! Mandatory. The unique identifier of the webhook to be updated.
input WebhookInput! Mandatory. Provides input data to the mutation.

Result

See the Webhook type.

verifyDomainIdentity

Initiates a new domain identity verification process at application level. You can also run this mutation if a previous verification attempt has stalled with status UNVERIFIED. See Verify a domain identity at application level for more information.

Arguments

Attribute Type Description
appId ID! Mandatory. The identifier of the app to which the domain identity is being added.
domain Domain! Mandatory. The Internet domain to be verified, for example example.org.

Result

See the DomainIdentity type.

Example

mutation verifyDomainIdentity($appId:ID!, $domain:Domain!) {
  verifyDomainIdentity(appId:$appId, domain:$domain) {
    domain
    status
    dnsRecords { type name value }
  }
}
{
    "appId": "YOUR_APP_ID",
    "domain": "example.org"
}

verifyEmailIdentity

Initiates an email identity verification process at application level. See Verify an email identity at application level for more information.

Arguments

Attribute Type Description
appId ID! Mandatory. The identifier of the app to which the email identity is being added.
address EmailAddress! Mandatory. The email address to be verified.

Result

See the EmailIdentity type.