Requirements
- A Firmhouse API access token with write access to start the bulk operation.
- Read access to the data selected by the query.
- One active bulk operation at a time per project.
Start a bulk operation
CallbulkOperationRunQuery with the GraphQL query you want Firmhouse to run.
errors in the response. Firmhouse can return query parse or validation messages there, for example when the query is malformed or uses an unsupported bulk operation shape. If errors is not empty, bulkOperation will be null and no background operation was created.
When the operation is accepted, the response contains a bulk operation with status CREATED. Store the id; you need it to check the operation later.
Query rules
Bulk operation queries use the same Firmhouse GraphQL schema as regular API requests, but the top-level query shape is restricted so the result can be exported predictably. Your query must:- Be a
queryoperation, not a mutation or subscription. - Select exactly one top-level field.
- Use a top-level connection field, such as a field that returns
nodesoredges { node { ... } }. - Leave top-level pagination arguments to Firmhouse. Do not pass
first,last,before, orafteron the top-level connection. - Not select more than five total connection fields in the query, including nested connections.
- Not select nested connections more than two connection levels below the top-level connection.
Check the status
Use thebulkOperation query with the ID from bulkOperationRunQuery.
CREATED: the operation was created and is waiting to start.RUNNING: Firmhouse is reading the data.COMPLETED: the JSONL result file is ready andurlis available.FAILED: the operation could not complete. CheckerrorCode.
Download the JSONL result
When the status isCOMPLETED, download the file from url.
The file is JSONL, also known as newline-delimited JSON. Each line is one complete JSON object from the selected connection:
Use the finished webhook
Instead of polling until completion, you can subscribe to thegraphql_bulk_operation_finished outgoing webhook event.
Create this webhook before you start the bulk operation if your integration should continue automatically when the result file is ready.
- In Firmhouse, go to Apps.
- Scroll to Webhooks and click Configure.
- Click New outgoing webhook.
- Enter a name, such as GraphQL bulk operation finished.
- Enter the endpoint URL in your own system that should receive the completion notification.
- Set Content type to JSON.
- Select the GraphQL bulk operation finished event.
- Add a JSON template that includes the bulk operation fields your integration needs.
- Click Save.
status and error_code before retrying or starting a new operation.
The url value is only available when the operation completed successfully. Your webhook handler should check status before trying to download the JSONL file.