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 GetTaxProfiles($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
      }
    }
  }
}// Variables Sample:
{"siteId":"test-site"}- Returns an array of tax profiles.
- You can specify any of the fields detailed in the Tax Profile Type Definition.
- For details about Pagination, Sorting, and Filtering Input Types, please check out PaginationGQLInputType, SortingGQLInputType, FilteringGQLInputType.
Tax Profile Query
query GetTaxProfile($siteId: String!, $taxProfileId: String!) {
    taxProfile(siteId: $siteId, taxProfileId: $taxProfileId) {
        name
        id
        taxAuthority
        percentage
        accountingReference
        taxInvoicingReference
        currency{
            code
            symbol
        }
    }
}// Variables Sample
{
 "siteId": "test-site",
 "taxProfileId": "9a2cc422-dd66-4062-ba69-ef8cd96d3e0b"
}
// The "taxProfileId" can be retrieved using the Tax Profiles Query.- Returns a specific tax profile.
- You can specify any of the fields detailed in the Tax Profile Type Definition.
Tax Profile Mutations
Create Tax Profile
- To create a new tax profile, you need to use the following Mutation, It is advisable to use variablesin 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 Sample:
{
  "siteId": "test-site",
  "taxProfile": {
    "name": "test tax profile",
    "taxAuthority": "ETA",
    "percentage": 0.14,
    "accountingReference": null,
    "taxInvoicingReference": null,
    "siteId": "test-site",
    "currencyCode": "egp"
  }
}- You can specify any of the fields detailed in the Tax Profile Type Definition.
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 Sample:
{
  "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"
  }
}- You can specify any of the fields detailed in the Tax Profile Type Definition.