REST API

Migrations API

Generated from the Celerp 2.9.0 OpenAPI schema, .

POST /migrations/bootstrap/decisions

Save Bootstrap Migration Decisions

Save the choices for a scanned source on a new installation that has no user yet: the import mode, the cutover date, the answers to the scan's questions and who prepared it. Every problem is returned at once, keyed by field. It is closed for good once any user exists.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.
modeobject--Import mode: full history or cutover.
cutover_dateobject--Date the books move over from the source. Required in cutover mode.
mappingsobject--Answers to the scan's questions, keyed by question.
prepared_byobject--Name of the person who prepared the migration, shown on the reconciliation pack. Optional, one line.

Responses

StatusDescriptionBody
200Returns the scan with the saved decisions.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/bootstrap/decisions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/bootstrap/scan

Bootstrap Scan

Parameters

NameInRequiredTypeDescription
x-setup-codeheader--string, optionalSetup code that authorizes this request while the instance is still being set up.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/bootstrap/scan \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/bootstrap/scan/read

Read Bootstrap Migration Scan

Return the view of a scanned source file on a new installation that has no user yet. It is closed for good once any user exists.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.

Responses

StatusDescriptionBody
200Returns the scan: what the source holds, what Celerp cannot import, and the questions that need an answer.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/bootstrap/scan/read \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/bootstrap/start

Bootstrap Start

Create the first owner, the staged company and a preparing run in one commit, then start it (``_claim``). The bootstrap lock serializes racing starts; the loser re-checks and is refused. If the response is lost after the commit, the owner signs in and is taken back to the run. The setup code is consumed only after the commit.

Parameters

NameInRequiredTypeDescription
x-setup-codeheader--string, optionalSetup code that authorizes this request while the instance is still being set up.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesScan Token
company_namestringyesCompany Name
timezonestring--Timezone
namestringyesName
emailstringyesEmail
passwordstringyesPassword

Responses

StatusDescriptionBody
201Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/bootstrap/start \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

GET /migrations/export-requests

Export Requests

Responses

StatusDescriptionBody
200Successful Responseobject

Example

curl -X GET http://localhost:8000/migrations/export-requests \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/export-requests

Send Export Request

Email a client the export checklist of a source; the files they upload are added here.

Request body

FieldTypeRequiredDescription
operation_idstringyesOperation Id
firm_namestringyesFirm Name
client_namestringyesClient Name
recipientstringyesRecipient
reply_tostringyesReply To
sourcestringyesSource

Responses

StatusDescriptionBody
201Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/export-requests \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/export-requests/{request_id}/add

Add Export Files

The client's files, read and added to the upload or to the open draft.

Parameters

NameInRequiredTypeDescription
request_idpathyesstringIdentifier of the export request whose files are to be added.

Request body

FieldTypeRequiredDescription
draft_tokenstring, optional--Draft Token

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/export-requests/:request_id/add \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/export-requests/{request_id}/revoke

Revoke Export Request

Parameters

NameInRequiredTypeDescription
request_idpathyesstringIdentifier of the export request to revoke.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/export-requests/:request_id/revoke \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/move-requests

Move Requests

Responses

StatusDescriptionBody
200Successful Responseobject

Example

curl -X GET http://localhost:8000/migrations/move-requests \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/move-requests

Send Move Request

Send the open export set to Celerp's team, who move the client and send back a company copy.

Request body

FieldTypeRequiredDescription
operation_idstringyesOperation Id
firm_namestringyesFirm Name
client_namestringyesClient Name
reply_tostringyesReply To
draft_tokenstring--Draft Token

Responses

StatusDescriptionBody
201Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/move-requests \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/move-requests/{request_id}/withdraw

Withdraw Move Request

Parameters

NameInRequiredTypeDescription
request_idpathyesstringIdentifier of the company move request to withdraw.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/move-requests/:request_id/withdraw \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/open

Get Open Runs

This person's moves still in progress, so any page can lead back to them.

Responses

StatusDescriptionBody
200Successful Responseobject

Example

curl -X GET http://localhost:8000/migrations/open \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/scan

Scan Migration Source

Upload a source file from another system and scan it, as a company owner. Send the file as a multipart upload. Nothing is imported at this step.

Responses

StatusDescriptionBody
200Returns the `scan_token` and the scan: what the source holds, what Celerp cannot import, and the questions that need an answer.object

Example

curl -X POST http://localhost:8000/migrations/scan \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/scan/decisions

Save Migration Decisions

Save the choices for a scanned source: the import mode, the cutover date, the answers to the scan's questions and who prepared it. Every problem is returned at once, keyed by field.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.
modeobject--Import mode: full history or cutover.
cutover_dateobject--Date the books move over from the source. Required in cutover mode.
mappingsobject--Answers to the scan's questions, keyed by question.
prepared_byobject--Name of the person who prepared the migration, shown on the reconciliation pack. Optional, one line.

Responses

StatusDescriptionBody
200Returns the scan with the saved decisions.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/scan/decisions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/scan/read

Read Migration Scan

Return the view of a scanned source file. When the caller already started a migration from this scan, it returns that run's `run_id` instead, so a client whose start response was lost can return to the run.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.

Responses

StatusDescriptionBody
200Returns the scan, or the `run_id` of the run already started from it.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/scan/read \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

GET /migrations/several

Several

Responses

StatusDescriptionBody
200Successful Responseobject

Example

curl -X GET http://localhost:8000/migrations/several \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/several

Upload Several

Keep each file of the upload as its own company to move, then list them all.

Responses

StatusDescriptionBody
201Successful Responseobject

Example

curl -X POST http://localhost:8000/migrations/several \
  -H "Authorization: Bearer $TOKEN"

DELETE /migrations/several/{file_id}

Remove Several

Parameters

NameInRequiredTypeDescription
file_idpathyesstringIdentifier of the migration file to remove.

Responses

StatusDescriptionBody
204Successful Response--
422Validation ErrorHTTPValidationError

Example

curl -X DELETE http://localhost:8000/migrations/several/:file_id \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/several/{file_id}/open

Open Several

Parameters

NameInRequiredTypeDescription
file_idpathyesstringIdentifier of the migration file to open.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/several/:file_id/open \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/sources

List Migration Sources

List the source systems the migration importer reads. Each source names the files it accepts, with their extensions and maximum sizes.

Responses

StatusDescriptionBody
200Returns the sources, each with its key, display name and accepted files.array of object

Example

curl -X GET http://localhost:8000/migrations/sources \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/staged

Get Staged Migration Run

Return the latest migration run of the staged company the session is scoped to, which tells a client where the session belongs.

Responses

StatusDescriptionBody
200Returns the migration run.object

Example

curl -X GET http://localhost:8000/migrations/staged \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/start-company/decisions

Save Migration Decisions for a Login With No Company

Save the choices for a scanned source that was uploaded for a login with no company: the import mode, the cutover date, the answers to the scan's questions and who prepared it. Every problem is returned at once, keyed by field.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.
modeobject--Import mode: full history or cutover.
cutover_dateobject--Date the books move over from the source. Required in cutover mode.
mappingsobject--Answers to the scan's questions, keyed by question.
prepared_byobject--Name of the person who prepared the migration, shown on the reconciliation pack. Optional, one line.

Responses

StatusDescriptionBody
200Returns the scan with the saved decisions.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/start-company/decisions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/start-company/scan

Scan Migration Source for a Login With No Company

Upload a source file from another system for a login that has no company left. The request authenticates with the login's email and password as HTTP Basic credentials. Send the file as a multipart upload. Nothing is imported at this step.

Responses

StatusDescriptionBody
200Returns the `scan_token` and the scan: what the source holds, what Celerp cannot import, and the questions that need an answer.object

Example

curl -X POST http://localhost:8000/migrations/start-company/scan \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/start-company/scan/read

Read Migration Scan for a Login With No Company

Return the view of a scanned source file that was uploaded for a login with no company.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.

Responses

StatusDescriptionBody
200Returns the scan: what the source holds, what Celerp cannot import, and the questions that need an answer.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/start-company/scan/read \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/start-company/start

Start Migration for a Login With No Company

Start a migration as the company of a login that has none left, then sign in to that company. The request carries the login's email and password, the scan token and the company name. If the login already has a company the request is refused.

Request body

FieldTypeRequiredDescription
emailstringyesEmail address of the login.
passwordstringyesPassword of the login.
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.
company_namestringyesName of the company to create from the source.
timezonestring--Timezone

Responses

StatusDescriptionBody
201Returns the session tokens for the staged company, the `run_id`, and whether the run is waiting for modules to load.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/start-company/start \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /migrations/start-from-scan

Start Migration From Scan

Start a migration from a scan and its saved decisions. It creates a staged company and a migration run. A repeated start from the same scan returns the run it already created.

Request body

FieldTypeRequiredDescription
scan_tokenstringyesToken returned when the source file was scanned. It identifies the uploaded scan in later calls.
company_namestringyesName of the company to create from the source.
timezonestring--Timezone

Responses

StatusDescriptionBody
201Returns the `run_id` of the new run and whether it is waiting for modules to load.object
422The request failed validation. The response lists each invalid field and why.HTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/start-from-scan \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

DELETE /migrations/templates/{source_system}

Forget Template

Forget the posting accounts this person's migrations from ``source_system`` saved.

Parameters

NameInRequiredTypeDescription
source_systempathyesstringSource system whose saved migration posting-account mappings are to be forgotten.

Responses

StatusDescriptionBody
204Successful Response--
422Validation ErrorHTTPValidationError

Example

curl -X DELETE http://localhost:8000/migrations/templates/:source_system \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/{run_id}

Get Run

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X GET http://localhost:8000/migrations/:run_id \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/cancel

Cancel Run

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
202Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/cancel \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/discard

Discard Run

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/discard \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/finalize

Finalize Run

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Request body

FinalizeIn, optional

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/finalize \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

GET /migrations/{run_id}/posting-accounts

Get Posting Accounts

The posting accounts finishing this migration will set, and the choices for each.

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X GET http://localhost:8000/migrations/:run_id/posting-accounts \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/{run_id}/reconciliation

Get Reconciliation

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X GET http://localhost:8000/migrations/:run_id/reconciliation \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/{run_id}/reconciliation/pack

Get Reconciliation Pack

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
200Successful Response--
422Validation ErrorHTTPValidationError

Example

curl -X GET http://localhost:8000/migrations/:run_id/reconciliation/pack \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/start

Start Run

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the migration run.

Responses

StatusDescriptionBody
202Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/start \
  -H "Authorization: Bearer $TOKEN"

GET /migrations/{run_id}/xero-attachments

Get Xero Attachments

The fetch of the files attached to this Xero migration's documents in Xero.

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the Xero migration run whose attachment import status is requested.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X GET http://localhost:8000/migrations/:run_id/xero-attachments \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/xero-attachments

Start Xero Attachments

Start fetching them, or return the fetch under way with its Xero sign-in link.

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the Xero migration run for which attachment fetching will start.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/xero-attachments \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/xero-attachments/confirm

Confirm Xero Attachments

Fetch from the organisation the Xero sign-in chose, as the owner saw it.

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the Xero migration run whose attachment fetch is being confirmed.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/xero-attachments/confirm \
  -H "Authorization: Bearer $TOKEN"

POST /migrations/{run_id}/xero-attachments/stop

Stop Xero Attachments

End the fetch and close its Xero access; files already attached stay.

Parameters

NameInRequiredTypeDescription
run_idpathyesstringIdentifier of the Xero migration run whose attachment fetch will stop.

Responses

StatusDescriptionBody
200Successful Responseobject
422Validation ErrorHTTPValidationError

Example

curl -X POST http://localhost:8000/migrations/:run_id/xero-attachments/stop \
  -H "Authorization: Bearer $TOKEN"