Tax Profiles API

The Tax Profiles API is an integral component of the core service. As a result, all requests should be directed to: https://api.subsbase.io/core/v2/graphql.

The core service expects 2 headers, the X-SITE-ID and Authorization so the request would be:

POST https://api.subsbase.io/core/v2/graphql
Authorization: Bearer {server token}
X-SITE-ID: {your site id}
Consuming the Tax Profiles API requires that a server token is used to authenticate the request. The server token is expected in the Authorization header.

Tax Profile Queries

Tax Profiles Query

query TaxProfiles($siteId: String!, $pagination: PaginationGQLInputType, $sorting: [SortingGQLInputType], $filter: FilterGQLInputType) {
  taxProfiles(
    siteId: $siteId
    pagination: $pagination
    sorting: $sorting
    filter: $filter
  ) {
    isSuccess
    message
    pagination {
      page
      perPage
      totalRecords
    }
    data {
      name
      id
      taxAuthority
      percentage
      accountingReference
      taxInvoicingReference
      currency {
        code
        symbol
        displayText
      }
    }
  }
}

Tax Profile Query

query TaxProfile($siteId: String!, $taxProfileId: String!) {
    taxProfile(siteId: $siteId, taxProfileId: $taxProfileId) {
        name
        id
        taxAuthority
        percentage
        accountingReference
        taxInvoicingReference
        currency{
            code
            symbol
        }
    }
}

### variables

{
    "siteId": "test-site",
    "taxProfileId": "89d8d0af-afd9-461f-9134-762ba1c45e1c"
}

Tax Profile Mutations

Create Tax Profile

  • To create a new tax profile, you need to use the following Mutation, It is advisable to use variables in this case since the input types are more complex than just strings:
mutation CreateTaxProfile($siteId: String!, $taxProfile: TaxProfileGQLInputType!) {
  taxProfiles(siteId: $siteId) {
    create(taxProfile: $taxProfile) {
      message
      isSuccess
    }
  }
}

### variables

{
  "siteId": "test-site",
  "taxProfile": {
    "name": "test tax profile",
    "taxAuthority": "ETA",
    "percentage": 0.14,
    "accountingReference": null,
    "taxInvoicingReference": null,
    "siteId": "test-site",
    "currencyCode": "egp"
  }
}

Update Tax Profile

  • To update a tax profile, you need to use the following Mutation:
Update TaxProfile 
mutation UpdateTaxProfile($siteId: String!, $taxProfileId: String!, $taxProfile: TaxProfileGQLInputType!) {
  taxProfile(siteId: $siteId, taxProfileId: $taxProfileId) {
    update(taxProfile: $taxProfile) {
      message
      isSuccess
    }
  }
}

### variables

{
  "siteId": "test-site",
  "taxProfileId": "1be6dfc1-9378-416b-a15e-a6d2509f8941",
  "taxProfile": {
    "name": "test tax profile",
    "taxAuthority": "ZATCA",
    "percentage": 0.14,
    "accountingReference": null,
    "taxInvoicingReference": null,
    "siteId": "test-site",
    "currencyCode": "egp"
  }
}