id you use for
everything that follows.
This guide covers the most common path: instantiating a case template. Creating a case without a
template is covered under Create a case without a template.
Before you start
You need:- A workspace API token (
pnbx_…). See Authentication. - The id of a case template in your workspace. Step 1 shows how to list them.
- Base URL:
https://connect.penbox.io/v1.
1
List your case templates
Read the template ids with
List Case Templates:Template ids are stable. Cache them per workspace rather than listing before every case.
2
Create the case
Pass the template id. The case inherits the template’s fields, sections, statuses and steps.Keep
title is required. template, status, reference, owner and contacts are optional;
each optional field has an automatic behaviour when omitted — see
Defaults.owner and contacts are different populations. The owner is a member of the workspace,
someone on your team who works the case. Contacts are the customers the case is about, and
the people you ask documents from. A contact cannot own a case.The key of a contact is the role it fills, such as main or billing. Use the keys the
template declares.Response, partial:id. Every later call needs it.Three things to know when you parse this response:schemais an array in the request and an object in the response, with the case fields underschema.data.- A field with no value has no
valuekey. Test for the key rather than comparing tonull. templateis returned as the template’s name, not as the object you sent. Keep the id on your side if you need it later.
locale, which sets the language of everything a contact sees.3
Write data into the case
Set any field of the schema with
Update Case Data. One call accepts as many fields as you
need:Penbox keeps the full history of each field. Sending a new value keeps the previous one
retrievable under
history, so you do not need to version case data yourself.Documents use a different sequence: upload the file first, then save its reference. See
Add a Document to a Case.Create a case without a template
Declare the fields inline withschema. Each entry needs a key, a name and a type. An entry
with a value prefills the field; an entry without one creates it empty.
locale
defaults to en unless you set it.
Field types and their options are listed in the Data Schema reference.
Choose the workspace
A token scoped to a single workspace needs nothing: the case is created there. A token scoped to several workspaces, or a partner token, must name the target workspace in the request body:404.
Defaults when you omit a field
Contact fields in the schema
schema.data contains a field per contact role and identity attribute — main_given_name,
main_family_name, main_email for the main role. They carry a contact property naming what
they mirror, such as "contact": "main.family_name", and they appear whether or not you send a
contacts array.
Read them if it is convenient, but do not write to them, and do not declare data fields of your own
for a contact’s personal information. The values live on the contact record.
Fields outside the schema
POST /v1/cases/{id}/data accepts any key. A key the schema does not declare is stored under
schema.other instead of schema.data, and it is not displayed as a case field.
Check your keys against the schema returned at creation if a value you sent does not appear on the
case.
Related
Add a Document to a Case
Uploading a file and saving it on a case field
Create Case
The endpoint reference, with every parameter
Data Schema
Every field type and its options
Update Case Data
Writing values into case fields