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 keys’s scope must be set to account-api:query:* account-api:mutation:*.
Usage
The Account API enables you to manage through API calls all SBS entities that are otherwise manageable 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 at the top of this page, or directly from the SBS Console. To access the GraphQL interface from the SBS Console:
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 and account users.
Arguments
None.
Result
Account type
Attribute
Type
Description
id
ID
The unique identifier of the account.
email
String
The email address associated with the account. NOTE: This field is deprecated.
The details of the company that owns this SBS account.
onlineBankingEnabled
Boolean
Boolean flag which 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.
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 ANAF OAuth 2.0 secrets.
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 ANAF OAuth 2.0 secrets.
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.
The email addresses authorized to send email at application level.
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 app-level or tenant-level key. Specifically, app-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.
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.
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 which 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.
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 whether the domain has been verified or not. This is an enum with the following possible values: PENDING, VERIFIED.
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.
apps
Returns information about multiple applications. The filtering options are supplied as input argument.
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 usage statistics about SBS services. You can query, for example, how many times a particular query or mutation of a particular service was called.
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 statistics beginning with this date.
to
DateTime
Optional. When provided, the call will return statistics up to this date only.
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 statistics should be returned. Valid values: query, mutation.
field
Field
Optional. Specifies the name of the query or mutation for which statistics should be returned.
appId
ID
Optional. When an appId is specified, only statistics 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. When a tenantId is specified, only statistics for this tenant will be returned. It is meaningful to supply this value only if service requires a tenant-level access key.
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
field
Field
The query or mutation involved in this statistic.
appId
ID
The ID of the app involved in this statistic.
tenantId
ID
The ID of the tenant involved in this statistic.
count
Float
Specifies the actual number of calls that took place, taking into account any filtering options that were set.
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
[Permission]
The list of permissions assigned to the portal user, as an array of Permission objects.
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
ID
The unique identifier of the tenant to which the permission applies.
tenant
Tenant
The object of type Tenant to which the permission applies.
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 string that identifies the key type. If the private key is application-level, it begins with app-. If the key is tenant-level, it begins with ten-.
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the CallsResult 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
ServiceAccessKeysResult 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.
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 app-level service access key. Use TENANT to retrieve services that require a tenant-level service access key.
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.
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the CallsResult 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). Currently, the following services have counters:
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, the call will return usage beginning with this date.
to
DateTime
Optional. When provided, the call will return usage up to this date only.
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 usageMeasurementTypes 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. Supplying this filter is meaningful only for services that have test and production environments (currently, ro-efactura-api, ro-etransport-api, and online-banking-api).
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.
When you run the usage query, some filters are not applicable, depending on the service supplied as input. This query indicates which filters apply to and are meaningful for the service supplied as input.
Arguments
Attribute
Type
Description
service
ServiceCode!
Mandatory. The code of the service for which you would to obtain information. You can obtain the service code of each service by running the services query.
Result
UsageFilters type
Attribute
Type
Description
appId
Boolean
True if this service is filterable by an appId, false otherwise.
tenantId
Boolean
True if this service is filterable by a tenantId, false otherwise.
environment
Boolean
True if this service is filterable by an environment, false otherwise.
usageMeasurementTypes
Returns the measurement types (names of usage counters) supported by a given service. This is useful for those services that have usage counters, such as ro-efactura-api, ro-etransport-api, and others.
Arguments
Attribute
Type
Description
service
ServiceCode!
Mandatory. The code of the service for which you are requesting measurement types. You can obtain the service code from the endpoint URL of each service, by extracting from the URL the string part after https:// and before .socrate. For example, if the URL is https://tax-declarations-api.socrate.xyz/graphql, then the service code is tax-declarations-api.
Result
An array of type codes. Each type code is the name of the measurement type. For example, if the service supplied as input is tax-declarations-api, the returned type code is CSV_FILE_LINES.
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 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.
A service access denial prevents a tenant from running the designated set of queries and mutations. This is a quick way to block only a very specific resource temporarily without modifying the tenant’s service access key. You can revoke existing denials through the revokeServiceAccessDenial mutation. See also Service access denials.
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.
Sends an invitation to the email address supplied as input. If the user accepts the invitation, they will be added as a new account user with access to the SBS Console (for the SBS account that sent the invitation). The extent of permissions available to the new user are defined through the scope input parameter.
Optional. If you specify a provider, the user will be able to complete the invitation and become an account user only if their email address is from that provider. Valid values: GOOGLE, MICROSOFT, SOCRATE.
email
EmailAddress!
Mandatory. Specifies the email address of the account user to be invited.
scope
Scope!
Mandatory. Specifies the extent of permissions available to the new user. For example, to grant the user permissions to view all data across the SBS Console but not modify it, enter account-api:query:*. For more information, see Defining scope in GraphQL.
message
String
Optional. A custom text message to be included in the invitation email.
Result
AccountUserInvitationType type
Attribute
Type
Description
id
ID
The unique identifier of the invitation.
provider
Provider
The identifier of the email provider specified when running the inviteAccountUser mutation. Possible values: GOOGLE, MICROSOFT, SOCRATE.
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.
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.
scope
[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.
The unique identifier of the app where scope applies.
tenantId
ID
The unique identifier of the tenant where scope applies.
scope
Scope
The actual scope (extent of permissions) available to the user for this app and tenant combination. See Defining scope in GraphQL.
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.
Once registered, the email subdomain cannot be changed. You should choose your app’s email subdomain carefully. For more information, see Register an email subdomain.
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.
removeAccountUser
Deletes an account user.
Arguments
Attribute
Type
Description
id
ID!
Mandatory. The ID of the account user to be deleted.
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.
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.
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 ANAF OAuth 2.0 secrets.
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.
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.
roAnafEfacturaUseImplicitClientSecret
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 ANAF OAuth 2.0 secrets.
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.
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
ID!
Mandatory. Identifies the tenant where permissions are applicable.
scope
Scope!
Mandatory. 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.
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.