{"openapi":"3.0.0","info":{"title":"Automatic Cost Estimates Application API","description":"API methods of this application cannot be called directly. Instead, you should trigger Crowdin's platform API endpoint, Crowdin will authorize your request and route it to this app.\n\nExample call for crowdin.com \n\n    curl --request GET \n    --url \"https://crowdin.com/api/v2/applications/automatic-cost-estimates/api/data?report=raw&projects=479\" \n    --header \"Authorization: Bearer 70cf05deasdas78c84c73c4cf986ee0a3ee911w1dsad384e3c4asd1qdbbcf6b6db5732e\" \nExample call for Crowdin Enterprise \n\n    curl --request GET \n    --url \"https://acme.crowdin.com/api/v2/applications/automatic-cost-estimates/api/data?report=raw&projects=479&startDate=2023-06-01T06%3A32%3A01.048Z&endDate=2023-06-23T06%3A32%3A01.048Z\" \n    --header \"Authorization: Bearer 70cf05dee35sad12rfes0a3ee911462e7b0723rfdfrg1e45bbcf6b6db5732e\" \n","version":"1.0.0","x-logo":{"url":"https://support.crowdin.com/assets/crowdin-logo.svg"}},"servers":[{"url":"{protocol}//{host}/api/v2/applications/automatic-cost-estimates/api","variables":{"protocol":{"default":"https","enum":["https","http"],"description":"Protocol (https for production)"},"host":{"default":"crowdin.com","description":"Crowdin host (crowdin.com or {organization}.crowdin.com for Enterprise)"}}}],"paths":{"/settings":{"get":{"summary":"Get Settings","description":"Whether the app estimates the project's uploaded files, and how, as set now","operationId":"settings.get","tags":["Settings"],"parameters":[{"$ref":"#/components/parameters/EstimatesProjectId"}],"responses":{"200":{"description":"The settings","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/EstimatesSettings"}}}}}},"default":{"$ref":"#/components/responses/EstimatesFailure"}}},"put":{"summary":"Update Settings","description":"Turns the app on or off for the project and picks the rates template and the events; a field left out is kept. On needs a template and at least one event, and adds the app's webhook to the project; off removes it, even when the saved template was deleted since, though a templateId sent along is checked. Changes the project, confirm with the user first","operationId":"settings.update","tags":["Settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["projectId"],"properties":{"projectId":{"type":"integer"},"enabled":{"type":"boolean"},"templateId":{"type":"integer","nullable":true},"events":{"type":"array","items":{"type":"string","enum":["file.added","file.updated","file.reverted"]}}}}}}},"responses":{"200":{"description":"The settings saved","content":{"application/json":{"schema":{"properties":{"data":{"$ref":"#/components/schemas/EstimatesSettings"}}}}}},"default":{"$ref":"#/components/responses/EstimatesFailure"}}}},"/file-estimates":{"get":{"summary":"Get File Estimates","description":"The file's cost estimates, newest first, with their status in Crowdin's report archive","operationId":"estimates.list","tags":["Estimates"],"parameters":[{"$ref":"#/components/parameters/EstimatesProjectId"},{"$ref":"#/components/parameters/EstimatesFileId"}],"responses":{"200":{"description":"The estimates","content":{"application/json":{"schema":{"properties":{"data":{"type":"object","properties":{"file":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"path":{"type":"string"},"active":{"type":"boolean","description":"False while the file is importing"},"revision":{"type":"integer"}}},"estimates":{"type":"array","items":{"$ref":"#/components/schemas/EstimatesEstimate"}},"canGenerate":{"type":"boolean","description":"The project has a rates template, which Generate File Estimate needs"},"automation":{"type":"object","nullable":true,"description":"The events that make an estimate; null while the app is off","properties":{"events":{"type":"array","items":{"type":"string"}}}}}}}}}}},"default":{"$ref":"#/components/responses/EstimatesFailure"}}}},"/file-estimate-totals":{"get":{"summary":"Get Estimate Totals","description":"The sums of a finished estimate, per target language and TM match level. The first call exports the report from Crowdin and answers pending; call again until it is ready, which is kept from then on. An estimate with no report, or one Crowdin could not build, is answered 409. The export runs in Crowdin and the sums are kept by the app; the project is not changed","operationId":"estimates.totals","tags":["Estimates"],"parameters":[{"$ref":"#/components/parameters/EstimatesProjectId"},{"$ref":"#/components/parameters/EstimatesFileId"},{"name":"estimateId","in":"query","required":true,"description":"An id of Get File Estimates","schema":{"type":"string"}}],"responses":{"200":{"description":"The sums, or how far they are","content":{"application/json":{"schema":{"properties":{"data":{"type":"object","properties":{"state":{"type":"string","enum":["ready","pending","failed"]},"totals":{"$ref":"#/components/schemas/EstimatesTotals"}}}}}}}},"default":{"$ref":"#/components/responses/EstimatesFailure"}}}},"/file-estimate-generate":{"post":{"summary":"Generate File Estimate","description":"Asks Crowdin for a cost estimate of the file at its current revision, priced with the project's rates template, in every target language, counting the strings already pre-translated. Refused while the project has no template or the file is importing. Every call makes a new report. Changes the project, confirm with the user first","operationId":"estimates.generate","tags":["Estimates"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["projectId","fileId"],"properties":{"projectId":{"type":"integer"},"fileId":{"type":"integer"}}}}}},"responses":{"200":{"description":"The estimate asked for, queued","content":{"application/json":{"schema":{"properties":{"data":{"type":"object","properties":{"estimate":{"$ref":"#/components/schemas/EstimatesEstimate"}}}}}}}},"default":{"$ref":"#/components/responses/EstimatesFailure"}}}}},"components":{"parameters":{"EstimatesProjectId":{"name":"projectId","in":"query","required":true,"description":"The project, one of this organization's","schema":{"type":"integer"}},"EstimatesFileId":{"name":"fileId","in":"query","required":true,"description":"A source file of the project","schema":{"type":"integer"}}},"schemas":{"EstimatesSettings":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether the picked file events make an estimate"},"templateId":{"type":"integer","nullable":true,"description":"The rates template every estimate is priced with: a report settings template of the project, as Crowdin's API lists them (Enterprise GET /reports/settings-templates?projectId=, crowdin.com GET /projects/{projectId}/reports/settings-templates), that prices per unit with a TM net rate scheme. It may be picked while the app is off, for Generate File Estimate"},"events":{"type":"array","items":{"type":"string","enum":["file.added","file.updated","file.reverted"]}},"webhook":{"type":"string","nullable":true,"enum":["active","inactive","outdated","missing"],"description":"The project's webhook, through which the app hears of uploaded files: inactive, outdated or missing when someone turned it off, changed or deleted it, which Update Settings puts right; null while the app is off or when Crowdin did not tell"}}},"EstimatesTotals":{"type":"object","properties":{"units":{"type":"number","description":"Units to translate, summed over the target languages"},"unit":{"type":"string"},"cost":{"type":"number"},"currency":{"type":"string"},"languages":{"type":"integer"},"translationCost":{"type":"number"},"approvalCost":{"type":"number"},"savings":{"type":"number","description":"What TM matches took off translating every unit at the full rate"},"internalMatches":{"type":"boolean"},"byLanguage":{"type":"array","description":"The most expensive language first","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"units":{"type":"number"},"translationCost":{"type":"number"},"approvalCost":{"type":"number"},"cost":{"type":"number"},"savings":{"type":"number"},"matches":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string","description":"tmMatch, internalMatch (the report's own strings) or default (no match)"},"type":{"type":"string","description":"perfect, 100, a range such as 99-95, or noMatch"},"units":{"type":"number"},"rate":{"type":"number"},"cost":{"type":"number"}}}}}}}}},"EstimatesEstimate":{"type":"object","properties":{"id":{"type":"string"},"event":{"type":"string","enum":["file.added","file.updated","file.reverted","manual"],"description":"What made the estimate; manual is Generate File Estimate or Generate now on the page"},"revision":{"type":"integer"},"changes":{"type":"object","nullable":true,"description":"The strings the revision added, updated and deleted","properties":{"added":{"type":"integer"},"updated":{"type":"integer"},"deleted":{"type":"integer"}}},"requestedAt":{"type":"string","format":"date-time"},"templateId":{"type":"integer","nullable":true},"templateName":{"type":"string"},"status":{"type":"string","enum":["queued","in_progress","finished","failed","skipped"]},"progress":{"type":"integer"},"reason":{"type":"string","description":"Why it failed or was skipped"},"webUrl":{"type":"string","description":"The report in Crowdin's report archive; empty until it is there"},"totals":{"nullable":true,"description":"Null until Get Estimate Totals has read them once","allOf":[{"$ref":"#/components/schemas/EstimatesTotals"}]},"unread":{"type":"boolean","description":"Crowdin did not answer for the report this time; the other fields are as last known"}}},"EstimatesError":{"type":"object","properties":{"data":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string"},"reference":{"type":"string","description":"A code to quote to support, with a failure of the app itself"}}}}}}}},"responses":{"EstimatesFailure":{"description":"The message says what to change. 400 a request it cannot take; 401 no token, or the token of another method or one that expired: call through Crowdin's API again; 403 the caller does not manage the project (MANAGER_ACCESS_REQUIRED) or the app has no access to it (APP_ACCESS_DENIED); 404 not found (PROJECT_NOT_FOUND: no such project); 409 a conflict, or APP_UPDATE_NOT_APPLIED: an admin has to apply the app's update; 429 Crowdin limits requests, retry later; 500 the app failed, quote its reference; 502 Crowdin failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EstimatesError"}}}}}},"tags":[]}