Billing » API » Pricelist

This endpoint is responsible for handling pricelists.

Get all the pricelists

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

_allPricelistsMeta.page int page number, starting from zero
_allPricelistsMeta.perPage int number of items returned per
_allPricelistsMeta.sortField str field used to sort the returned items, defaults to id
_allPricelistsMeta.sortOrder str asc or desc, defaults to asc
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "{
  allPricelists {
    id
    tenant
    pricelist_tag
    name
    currency
  }
  meta: _allPricelistsMeta(page: 0, perPage: 10, sortField: \"pricelist_tag\", sortOrder: \"asc\") {
    count
  }
}" }
EOF

Response

allPricelists.id objectid Unique identifier of the pricelist
allPricelists.tenant string Name of the tenant
allPricelists.pricelist_tag string Pricelist tag
allPricelists.name string Name of the pricelist
allPricelists.currency PricelistCurrency USD or EUR
allPricelists.meta.count int Results count
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "allPricelists": [
      {
        "id": "20648787-4958-4928-9fd3-c926d7cec159",
        "tenant": "alex",
        "pricelist_tag": "pricelist2",
        "name": "Pricelist 2",
        "currency": "USD"
      },
      {
        "id": "58d16ce8-30ed-449d-a81c-c4f069ba6eff",
        "tenant": "alex",
        "pricelist_tag": "pricelist1",
        "name": "Pricelist One",
        "currency": "EUR"
      }
    ],
    "meta": {
      "count": 2
    }
  }
}

Get specific pricelist details

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

allTenants.filter.id id id of the specific pricelist
allTenants.filter.ids array array of pricelist ids to fetch
allTenants.filter.tenant str specify pricelist tenant
allTenants.filter.pricelist_tag str fetch pricelist by tag
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "{
  allPricelists(filter: {tenant: \"alex\", pricelist_tag: \"pricelist2\"}) {
    id
    tenant
    pricelist_tag
    name
    currency
  }
  meta: _allPricelistsMeta(page: 0, perPage: 10, sortField: \"pricelist_tag\", sortOrder: \"asc\") {
    count
  }
}" }
EOF

Response

allPricelists.id objectid Unique identifier of the pricelist
allPricelists.tenant string Name of the tenant
allPricelists.pricelist_tag string Pricelist tag
allPricelists.name string Name of the pricelist
allPricelists.currency PricelistCurrency USD or EUR
allPricelists.meta.count int Results count
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "allPricelists": [
      {
        "id": "20648787-4958-4928-9fd3-c926d7cec159",
        "tenant": "alex",
        "pricelist_tag": "pricelist2",
        "name": "Pricelist 2",
        "currency": "USD"
      }
    ]
  }
}

Create a new pricelist

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

createPricelist.id objectid Unique identifyer of the pricelist (if not provided an uuid4 will be generated automatically - best option)
createPricelist.tag string Unique tag of the pricelist
createPricelist.tenant string Name of the tenant
createPricelist.name string Descriptive name of the Pricelist
createPricelist.currency PricelistCurrency Currency used for this pricelist
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "mutation {
  createPricelist(pricelist_tag: \"new_pricelist\", name: \"Test pricelist\", tenant: \"alex\", currency: EUR) {
    id
    tenant
    pricelist_tag
    name
    currency
  }
}
"
}
EOF

Response

createPricelist.id objectid Identifier of the pricelist
createPricelist.pricelist_tag string Unique tag of the pricelist
createPricelist.tenant string Name of the tenant
createPricelist.name string Descriptive name of the Pricelist
createPricelist.currency PricelistCurrency Currency used for this pricelist
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "createPricelist": {
      "id": "f6b0ddff-0d6e-4acf-8fcc-a49409b69003",
      "tenant": "alex",
      "pricelist_tag": "new_pricelist",
      "name": "Test pricelist",
      "currency": "EUR"
    }
  }
}

Update a pricelist

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

createPricelist.id objectid Unique identifyer of the pricelist to update
createPricelist.pricelist_tag string Unique tag of the pricelist to update
createPricelist.tenant string Name of the tenant
createPricelist.name string Descriptive name of the Pricelist
createPricelist.currency PricelistCurrency Currency used for this pricelist
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "mutation {
  updatePricelist(pricelist_tag: \"new_pricelist\", name: \"Updated pricelist\", tenant: \"alex\", currency: USD) {
    id
    tenant
    pricelist_tag
    name
    currency
  }
}"
}
EOF

Response

createPricelist.id objectid Identifier of the pricelist
createPricelist.pricelist_tag string Unique tag of the pricelist
createPricelist.tenant string Name of the tenant
createPricelist.name string Descriptive name of the Pricelist
createPricelist.currency PricelistCurrency Currency used for this pricelist
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "updatePricelist": {
      "id": "f6b0ddff-0d6e-4acf-8fcc-a49409b69003",
      "tenant": "alex",
      "pricelist_tag": "new_pricelist",
      "name": "Updated pricelist",
      "currency": "USD"
    }
  }
}

Delete a pricelist

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

deletePricelist.id objectid Identifier of the pricelist
deletePricelist.tenant string Name of the tenant
deletePricelist.pricelist_tag string Unique tag of the pricelist
POST

/graphql

Example request with curl
$ curl "https://api.canyan.io/graphql" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-token-here>" \
  --data @- <<EOF
{"query": "mutation {
  deletePricelist(pricelist_tag: "new_pricelist", tenant: "alex") {
    id
    tenant
    pricelist_tag
    name
    currency
  }
}
"
}
EOF

Response

deletePricelist.id objectid Identifier of the deleted pricelist
deletePricelist.pricelist_tag string Unique tag of the pricelist just deleted
deletePricelist.tenant string Deleted Pricelist name of the tenant
deletePricelist.name string Descriptive name of the deleted Pricelist
deletePricelist.currency PricelistCurrency Currency used for the deleted pricelist
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "deletePricelist": {
      "id": "f6b0ddff-0d6e-4acf-8fcc-a49409b69003",
      "tenant": "alex",
      "pricelist_tag": "new_pricelist",
      "name": "Updated pricelist",
      "currency": "USD"
    }
  }
}
Stay updated

By registering with us you will receive right in your inbox all new features and updates

Check your email

We sent you an email with a link to get started. You’ll be in your account in no time.