Submit one analysis
A JSON body declares exactly one input: a url, text, html with the url it came from, or structured items with the country they were bought in. Two inputs is a 422, and each answers 202 with the session id.
A multipart/form-data body is a file. country_code is required with it, because a file carries no country of its own and nothing is assumed: the footprint is calculated for the country the caller declares, and prices with no stated currency are read in that country's currency. kind chooses the backend, and is otherwise decided by the extension — .pdf .docx .doc .txt .md are documents, .csv .xlsx .xls .tsv .ofx .qfx .qif .iif are accounting files. A document over 100 KB or an accounting file over 1 MB is refused here with a 413 before it is forwarded.
The two kinds finish differently. An accounting file is analysed off the request and answers 202 with links.import beside the session links. A DOCUMENT IS ANALYSED INSIDE THE REQUEST by the main app's single worker process, so the request is held for the length of the analysis — up to 180 seconds — and answers 200 with status 'completed', because by then the work is done.
Request
- Base URL: https://carbonguru.io
- URL: https://carbonguru.io/v1/analyses
- Auth: HTTP bearer
Headers
A key of the caller's choosing, held 24 hours and scoped to the account, the method and the path. The same key with the same body replays the stored response with Idempotent-Replayed: true. The same key with a different body is a 409 idempotency_key_reuse. A request still running under the key is a 409 idempotency_in_progress. A key longer than 255 characters or holding control characters is a 422. A write whose record cannot be stored is still processed once, without the replay guarantee. A response carrying a secret is never replayed: the second request receives a 409 idempotency_secret_not_replayable.
Request body
Response
A document, analysed inside the request. status is 'completed'.
Changes
No recorded changes to this operation across all 1 revision of this API.