Billing » API » Pricelist rate

This endpoint is responsible for handling rates.

Get all the rates

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": "{
  allPricelistRates {
    id
    tenant
    pricelist_tag
    carrier_tag
    prefix
    datetime_start
    datetime_end
    connect_fee
    rate
    rate_increment
    interval_start
    description
  }
  meta: _allPricelistsMeta(page: 0, perPage: 10, sortField: "id", sortOrder: "asc") {
      count
  }
}
" }
EOF

Response

allPricelistRates.id objectid Identifier of the pricelist rate
allPricelistRates.tenant string The associated tenant of the pricelist rate
allPricelistRates.pricelist_tag string The tag of the associated pricelist
allPricelistRates.carrier_tag string The carrier of the pricelist rate
allPricelistRates.prefix string The prefix to trigger this pricelist rate
allPricelistRates.datetime_start datetime The date and time this pricelist rate is active from
allPricelistRates.datetime_end datetime The date and time this pricelist rate is active to
allPricelistRates.connect_fee int The one time fee triggered on connection
allPricelistRates.rate int The rate applied to this destination prefix
allPricelistRates.rate_increment int The time span the rate is incremented (every x seconds)
allPricelistRates.interval_start int The interval in secods this rate starts to be applied
allPricelistRates.description string A brief description of this pricelist rate
meta.count int Results count
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "allPricelistRates": [
      {
        "id": "c856fd20-e414-4e40-8730-b83557dbe4f6",
        "tenant": "alex",
        "pricelist_tag": "pricelist1",
        "carrier_tag": "carrier1",
        "prefix": "39",
        "datetime_start": null,
        "datetime_end": null,
        "connect_fee": 0,
        "rate": 1,
        "rate_increment": 60,
        "interval_start": 0,
        "description": "Italy"
      },
      {
        "id": "b8cb3f74-d102-4901-8d97-00b46e0a39aa",
        "tenant": "alex",
        "pricelist_tag": "pricelist1",
        "carrier_tag": "carrier1",
        "prefix": "385",
        "datetime_start": null,
        "datetime_end": null,
        "connect_fee": 0,
        "rate": 10,
        "rate_increment": 30,
        "interval_start": 0,
        "description": "Croatia"
      },
      {
        "id": "73b52d52-de9b-48f8-a40a-d879eecaeb4b",
        "tenant": "alex",
        "pricelist_tag": "pricelist1",
        "carrier_tag": "carrier2",
        "prefix": "36",
        "datetime_start": null,
        "datetime_end": null,
        "connect_fee": 0,
        "rate": 20,
        "rate_increment": 60,
        "interval_start": 60,
        "description": "Hungary"
      }
    ],
    "meta": {
      "count": 3
    }
  }
}

Get specific pricelist rate

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

allPricelistRates.filter.id id id of the carrier
allPricelistRates.filter.ids array array of ids to fetch
allPricelistRates.filter.tenant array filter carriers by tenant
allPricelistRates.filter.pricelist_id array filter carriers by tenant
allPricelistRates.filter.pricelist_tag array filter carriers by tenant
allPricelistRates.filter.carrier_id array get a carrier by it's tag
allPricelistRates.filter.carrier_tag array get a carrier by it's tag
allPricelistRates.filter.prefix array get a carrier by it's 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": "{
  allPricelistRates(filter: {prefix: \"36\", tenant:\"alex\", carrier_tag:\"carrier2\"}) {
    id
    tenant
    pricelist_tag
    carrier_tag
    prefix
    datetime_start
    datetime_end
    connect_fee
    rate
    rate_increment
    interval_start
    description
  }
}"
}
EOF

Response

allPricelistRates.id objectid Identifier of the pricelist rate
allPricelistRates.tenant string The associated tenant of the pricelist rate
allPricelistRates.pricelist_tag string The tag of the associated pricelist
allPricelistRates.carrier_tag string The carrier of the pricelist rate
allPricelistRates.prefix string The prefix to trigger this pricelist rate
allPricelistRates.datetime_start datetime The date and time this pricelist rate is active from
allPricelistRates.datetime_end datetime The date and time this pricelist rate is active to
allPricelistRates.connect_fee int The one time fee triggered on connection
allPricelistRates.rate int The rate applied to this destination prefix
allPricelistRates.rate_increment int The time span the rate is incremented (every x seconds)
allPricelistRates.interval_start int The interval in secods this rate starts to be applied
allPricelistRates.description string A brief description of this pricelist rate
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "allPricelistRates": [
      {
        "id": "73b52d52-de9b-48f8-a40a-d879eecaeb4b",
        "tenant": "alex",
        "pricelist_tag": "pricelist1",
        "carrier_tag": "carrier2",
        "prefix": "36",
        "datetime_start": null,
        "datetime_end": null,
        "connect_fee": 0,
        "rate": 20,
        "rate_increment": 60,
        "interval_start": 60,
        "description": "Hungary"
      }
    ]
  }
}

Create a new pricelist rate

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

createPricelistRate.id objectid Unique identifyer of the pricelist rate (if not provided an uuid4 will be generated automatically - best option)
createPricelistRate.tenant string The associated tenant of the pricelist rate
createPricelistRate.pricelist_tag string The tag of the associated pricelist
createPricelistRate.carrier_tag string The carrier of the pricelist rate
createPricelistRate.prefix string The prefix to trigger this pricelist rate
createPricelistRate.datetime_start datetime The date and time this pricelist rate is active from
createPricelistRate.datetime_end datetime The date and time this pricelist rate is active to
createPricelistRate.connect_fee int The one time fee triggered on connection
createPricelistRate.rate int The rate applied to this destination prefix
createPricelistRate.rate_increment int The time span the rate is incremented (every x seconds)
createPricelistRate.interval_start int The interval in secods this rate starts to be applied
createPricelistRate.description string A brief description of this pricelist rate
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 {
  createPricelistRate(
        tenant: \"alex\",
        pricelist_tag: \"pricelist1\",
        carrier_tag: \"carrier1\",
        prefix: \"49\",
        connect_fee: 0,
        rate: 20,
        rate_increment: 60,
        interval_start: 60,
        description: \"Germany\"
  ) {
    id
    tenant
    pricelist_tag
    carrier_tag
    prefix
    datetime_start
    datetime_end
    connect_fee
    rate
    rate_increment
    interval_start
    description
  }
}"
}
EOF

Response

createPricelistRate.id objectid Identifier of the pricelist rate
createPricelistRate.tenant string The associated tenant of the pricelist rate
createPricelistRate.pricelist_tag string The tag of the associated pricelist
createPricelistRate.carrier_tag string The carrier of the pricelist rate
createPricelistRate.prefix string The prefix to trigger this pricelist rate
createPricelistRate.datetime_start datetime The date and time this pricelist rate is active from
createPricelistRate.datetime_end datetime The date and time this pricelist rate is active to
createPricelistRate.connect_fee int The one time fee triggered on connection
createPricelistRate.rate int The rate applied to this destination prefix
createPricelistRate.rate_increment int The time span the rate is incremented (every x seconds)
createPricelistRate.interval_start int The interval in secods this rate starts to be applied
createPricelistRate.description string A brief description of this pricelist rate
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "createPricelistRate": {
      "id": "a82d0e60-1f87-406f-b250-46ca972861c6",
      "tenant": "alex",
      "pricelist_tag": "pricelist1",
      "carrier_tag": "carrier1",
      "prefix": "49",
      "datetime_start": null,
      "datetime_end": null,
      "connect_fee": 0,
      "rate": 20,
      "rate_increment": 60,
      "interval_start": 60,
      "description": "Germany"
    }
  }
}

Update a pricelist rate

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

This method is used to update the datetime_start and end, the fee and rate fields and the description. If the id is not provided to match the pricelist rate the combination of tenant or pricelist_id or pricelist_tag and with the carrier tag is used all in combination with the prefix.

updatePricelistRate.id objectid Unique identifyer of the pricelist rate
updatePricelistRate.tenant string The associated tenant of the pricelist rate
updatePricelistRate.pricelist_tag string The tag of the associated pricelist
updatePricelistRate.carrier_tag string The carrier of the pricelist rate
updatePricelistRate.prefix string The prefix to trigger this pricelist rate
updatePricelistRate.datetime_start datetime The date and time this pricelist rate is active from
updatePricelistRate.datetime_end datetime The date and time this pricelist rate is active to
updatePricelistRate.connect_fee int The one time fee triggered on connection
updatePricelistRate.rate int The rate applied to this destination prefix
updatePricelistRate.rate_increment int The time span the rate is incremented (every x seconds)
updatePricelistRate.interval_start int The interval in secods this rate starts to be applied
updatePricelistRate.description string A brief description of this pricelist rate
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 {
  updatePricelistRate(
    tenant: \"alex\",
    pricelist_tag: \"pricelist1\",
    carrier_tag: \"carrier1\",
    prefix: \"49\",
    connect_fee: 0,
    rate: 10,
    rate_increment: 60,
    interval_start: 0,
    description: \"Germany updated\"
  ) {
    id
    tenant
    pricelist_tag
    carrier_tag
    prefix
    datetime_start
    datetime_end
    connect_fee
    rate
    rate_increment
    interval_start
    description
  }
}"
}
EOF

Response

updatePricelistRate.id objectid Identifier of the pricelist rate
updatePricelistRate.tenant string The associated tenant of the pricelist rate
updatePricelistRate.pricelist_tag string The tag of the associated pricelist
updatePricelistRate.carrier_tag string The carrier of the pricelist rate
updatePricelistRate.prefix string The prefix to trigger this pricelist rate
updatePricelistRate.datetime_start datetime The date and time this pricelist rate is active from
updatePricelistRate.datetime_end datetime The date and time this pricelist rate is active to
updatePricelistRate.connect_fee int The one time fee triggered on connection
updatePricelistRate.rate int The rate applied to this destination prefix
updatePricelistRate.rate_increment int The time span the rate is incremented (every x seconds)
updatePricelistRate.interval_start int The interval in secods this rate starts to be applied
updatePricelistRate.description string A brief description of this pricelist rate
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "updatePricelistRate": {
      "id": "a82d0e60-1f87-406f-b250-46ca972861c6",
      "tenant": "alex",
      "pricelist_tag": "pricelist1",
      "carrier_tag": "carrier1",
      "prefix": "49",
      "datetime_start": null,
      "datetime_end": null,
      "connect_fee": 0,
      "rate": 10,
      "rate_increment": 60,
      "interval_start": 0,
      "description": "Germany updated"
    }
  }
}

Delete a pricelist rate

Request headers

Content-Type application/json
Authorization Bearer <token>

Request parameters

deletePricelistRate.id identifyer Unique identifyer of the pricelist rate
deletePricelistRate.pricelist_tag string The tag of the associated pricelist rate
deletePricelistRate.carrier_tag string The tag of the carrier
deletePricelistRate.tenant string The tenant of the pricelist rate
deletePricelistRate.carrier_tag string The carrier of the pricelist rate
deletePricelistRate.prefix string The prefix to trigger this pricelist rate deletion
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 {
  deletePricelistRate(id: "a82d0e60-1f87-406f-b250-46ca972861c6") {
    id
    tenant
    pricelist_tag
    carrier_tag
    prefix
    datetime_start
    datetime_end
    connect_fee
    rate
    rate_increment
    interval_start
    description
  }
}"
}
EOF

Response

deletePricelistRate.id objectid Identifier of the deleted pricelist rate
deletePricelistRate.tenant string The associated tenant of the pricelist rate
deletePricelistRate.pricelist_tag string The tag of the associated pricelist
deletePricelistRate.carrier_tag string The carrier of the pricelist rate
deletePricelistRate.prefix string The prefix to trigger this pricelist rate
deletePricelistRate.datetime_start datetime The date and time this pricelist rate is active from
deletePricelistRate.datetime_end datetime The date and time this pricelist rate is active to
deletePricelistRate.connect_fee int The one time fee triggered on connection
deletePricelistRate.rate int The rate applied to this destination prefix
deletePricelistRate.rate_increment int The time span the rate is incremented (every x seconds)
deletePricelistRate.interval_start int The interval in secods this rate starts to be applied
deletePricelistRate.description string A brief description of this pricelist rate
Example response
HTTP/1.1 200 OK
Content-Type: application/json
{
  "data": {
    "deletePricelistRate": {
      "id": "a82d0e60-1f87-406f-b250-46ca972861c6",
      "tenant": "alex",
      "pricelist_tag": "pricelist1",
      "carrier_tag": "carrier1",
      "prefix": "49",
      "datetime_start": null,
      "datetime_end": null,
      "connect_fee": 0,
      "rate": 10,
      "rate_increment": 60,
      "interval_start": 0,
      "description": "Germany updated"
    }
  }
}
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.