Here's the full guide with every fix from the accuracy check applied.
The Pie API lets your own apps and scripts read and update your organization's Pie data: projects, tasks, assignments, time and more. It's the same GraphQL API (one web address that takes queries) that the Pie web app runs on.
Full API reference: developers.my.pie.me/welcome
1. Who can use it
- Your organization must be on the Enterprise plan, and not on a trial.
- Only an organization admin can create tokens. The INTEGRATION tab is shown only to organization admins.
- An organization can have up to 10 active tokens.
-
A token belongs to the organization, not to the admin who created it. It keeps working if that admin later loses admin rights or closes their Pie account.
2. Create an organization access token
- Sign in to Pie as an organization admin.
- Open Settings and go to the ORGS & WORKSPACES tab. You can also go straight to
https://my.pie.me/settings/workspaces. - Hover over your organization's bar and then click the Description icon (first icon that has the square with three lines). The Organization Configuration page opens.
- Open the INTEGRATION tab. The section is called API Organization Access Token. If your organization isn't on the Enterprise plan, or is a trial, this section doesn't appear.
- In Enter token name, type a name you'll recognize later, such as "Salesforce integration".
- Under Access, choose one:
- Read (selected by default): reads this organization's data and changes nothing.
- Read + write: also creates and changes projects, tasks, assignments and time in this organization.
- Click Create token.
-
Copy the token right away, using Copy to clipboard. It starts with
pie_pat_and is shown only once.
The new token then appears in the list on this tab, which replaces the message "No active tokens for this organization." If the organization already has 10 active tokens, Pie shows "You can only have 10 active tokens for this organization". Revoke one you no longer need first.
Store the token like a password, for example in a secrets manager. Never put it in shared documents or in code that others can see.
3. Send your first request
Every request is a POST to:
https://my.pie.me/api
Put the token in the Authorization header: the word Bearer, written exactly like that with a capital B, then a space, then the token.
curl -X POST https://my.pie.me/api \
-H "Authorization: Bearer pie_pat_your_token_here" \
-H "Content-Type: application/json" \
-d '{"query": "{ organizations { id name workspaces { id name } } }"}'
The answer shows your organization and its workspaces. Use organizations as your starting point, because me is refused for tokens (a token isn't a person).
Next, list the organization's projects:
{ projectListView { standaloneProjects { id title } stacks { id title projects { id title } } } }
4. Find your way around the data
Organization → Workspace → Project → Slice → Task (optionally grouped in a Box)
- Read a project's slices through
project, and its tasks throughprojectTodos(projectId:)orsliceTodos(sliceIds:). -
recipeslists your organization's recipes, which you can use as templates to create projects. - The full reference of every query, change and field is at developers.my.pie.me.
- To try queries in your browser, use the explorer at https://my.pie.me/api/graphiql.
Important: the explorer runs as your own Pie account, not as a token. Its results show what you can see, which may be more than a token can see. Any change you make there is real and appears under your name.
5. What a token can see
- Only its own organization. Nothing from any other organization is ever returned.
- Every task in every project of the organization's shared workspaces.
- Every member's project, task and non-project time.
- Billing and cost rates.
- Not anyone's personal workspace or "My Work" page.
6. Making changes (Read + write tokens only)
A Read + write token can make these changes:
-
Projects:
- Create a project: empty, with a list of slices (
slices), or from a recipe (recipeId). It can be placed in a stack. - Update a project's details, status dot and data fields.
- A token can't close or reopen a project, move it to another workspace or stack, or attach files.
- Create a project: empty, with a list of slices (
- Boxes: create a box, create a board, delete a box.
-
Tasks:
- Create, update, delete and move tasks.
- Delete every task in a slice or box at once.
- Change dates, checklists and data fields, and set dependencies.
-
Assignments:
- Assign people to a task, a whole slice, a project, or a stack (as stack admin), and remove them.
- Change the role on a project assignment.
- The roles a token can give are member and only my work. Admin can be given only when the token creates the project.
- Project roles: give a person an existing project role, or attach the role to a task, and take it away again. A token can't create, rename or delete roles.
- Workspace members: add an existing organization member to another workspace in the organization, as a member.
- Time: log time and planned time on task, project and non-project rows.
-
Comments: add, edit and delete comments on a task, slice or project, and reply to comments. An issue can be assigned to a person with
ownerIdorownerEmail. - Tags: add the organization's existing color tags to tasks, and remove them.
Rules to know:
- Changes show as "API User #code" (the token's short code, listed in the token table) in task history, comments, alerts and emails. The API User isn't a member: it takes no seat and receives no email.
-
Name people by id or by email address (
userId/userEmail,ownerEmail). They must already be members of your organization. Nobody is ever invited. - A new project needs at least one project admin among its assignments, and every assignment must name a person.
- No rates or permissions: a token can't set billing or cost rates on assignments or workspace members, and can't set workspace permissions.
-
Time is always logged on a named person's timesheet:
- For task and project time, the person must be on that project's team.
- Non-project time can be logged for anyone in the organization.
- Only your organization's existing time tags can be used.
-
Logged time adds to what's already there.
- To avoid double-counting, send your own id for each entry in
externalId, for example a Jira work log id. - Hours sent again with the same id replace the earlier hours, and a new id adds hours. Without an id, sending the same entry twice doubles the hours.
- If someone corrects the hours in Pie, sending the same id again adds only the difference from what you sent before, so the correction in Pie is kept.
- To remove hours, set them to 0.
- To avoid double-counting, send your own id for each entry in
Example: create a task in a slice.
mutation {
createTodo(todo: { sliceId: 123, title: "Kick-off call" }) {
todoId
}
}
7. Limits
Each Read + write token has its own limits per 10 minutes:
- 50 new projects
- 500 single task assignments
- 50 whole-slice assignments
When a limit is reached, the answer names the limit and says when to try again.
8. When something goes wrong
| Answer | Meaning |
|---|---|
Unauthorized |
Token missing, mistyped, revoked or stopped. Check that the header says Bearer followed by the token. |
api_token_read_only |
A Read token tried to change something. |
api_token_not_allowed |
That change isn't available to tokens (see section 6). |
person_not_found |
The person named isn't a member of your organization, or their account is closed. |
assignment_person_required |
An assignment on a new project doesn't name a person. |
project_admin_required |
A new project needs at least one project admin. |
unknown_time_tag |
That time tag doesn't exist in your organization. |
| Rate limit message | A limit in section 7 was reached. The message says when to try again. |
9. Managing tokens
- Your tokens are listed on the same INTEGRATION tab of the Organization Configuration page (see section 2, steps 2–4).
- For each token, the list shows:
- its name and access (Read or Read + write)
- its code (for example #7k2m9), which is the code shown in "API User #code"
- its prefix (the first characters of the token)
- the date it was created and who created it
- when it was last used ("Never" if it hasn't been used yet)
- Click Revoke next to a token, then Revoke again to confirm. Any app using it stops working right away, and this can't be undone.
- All tokens stop if the organization leaves the Enterprise plan, becomes a trial or is deleted. The list then marks each one "Stopped: organization is no longer Enterprise" or "Stopped: organization is a trial", and the form for creating new tokens disappears.
Comments
0 comments
Article is closed for comments.