Skip to main content

Create a service

POST/api/v1/services

  • Needs an API key, and runs with the access of the member who made the key.
  • Send an Idempotency-Key. The same key with the same request within 24 hours gives the first answer again and changes nothing.
  • A connected AI assistant can use it too, as createService.

Parameters

Headers

  • Idempotency-Keystringrequired

    Unique user-scoped key for safely retrying this mutation for 24 hours.

    At least 1 character. Up to 200 characters.

Request body

Sent as application/json.

  • serviceobjectrequired

    Fields(8)
    • lock_versioninteger

      At least 0.

    • namestringrequired

    • descriptionstring or null

    • unit_namestring

    • unit_price_centsinteger (int64)

      Integer minor currency units, such as pence.

      At least 0.

    • tax_rate_basis_pointsinteger

      At least 0. At most 10000.

    • tax_inclusiveboolean

    • activeboolean

Responses

201Service details.

  • dataobjectrequired

    Fields(12)
    • lock_versioninteger

      At least 0.

    • created_atstring (date-time)required

    • updated_atstring (date-time)required

    • idstring (uuid)required

    • account_idstring (uuid)required

    • namestringrequired

    • descriptionstring or null

    • unit_namestringrequired

    • unit_price_centsinteger (int64)required

      Integer minor currency units, such as pence.

      At least 0.

    • tax_rate_basis_pointsintegerrequired

      At least 0. At most 10000.

    • tax_inclusivebooleanrequired

    • activebooleanrequired

A refusal answers in the one error shape every operation shares.

Example

A request our own tests send. The ids are made up: put your own in their place.

curl -X POST "https://app.tradesender.co.uk/api/v1/services" \
  -H "Authorization: Bearer $TRADESENDER_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "service": {
    "name": "Hedge cutting",
    "description": "Cut and shaped, by the hour.",
    "unit_name": "each",
    "unit_price_cents": 12000,
    "tax_rate_basis_points": 2000,
    "tax_inclusive": false
  }
}'