{"openapi":"3.1.0","info":{"title":"External API (Deprecated)","version":"1.0.0"},"paths":{"/external/v2/contractor":{"post":{"operationId":"externalApi_createContractorV2","summary":"Create Contractor","description":"Creates a contractor and their contract in a single call, for any contract type: fixed rate, flexible rate, milestone, or time tracking. The contractor is invited by email and becomes payable once they complete onboarding.","tags":["Contractors"],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalSuccessResponse"}}}},"400":{"description":"A field failed validation, for example an invalid ISO 3166-1 alpha-2 country code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"409":{"description":"That contractor already has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalCreateContractorRequestV2"}}}},"security":[{"default":[]}]}},"/external/v2/teams":{"get":{"operationId":"externalApi_getTeams","summary":"Get Teams","description":"Returns every team on your company. Use a teamId from here as the teamId on Create\nContractor V2, which requires one when your company has more than one team.\n\nSuperseded by Get Teams For Company on the Thera API, which returns each team with\nits contracts. Reaching it needs a key issued from Settings.","tags":["Contractors"],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_GetTeamsResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"security":[{"default":[]}]}},"/external/contractor/{email}/onboarding-status":{"get":{"operationId":"externalApi_getContractorOnboardingStatus","summary":"Get Onboarding Status","description":"Deprecated. Read this from the Thera API with your API key instead. Returns how far the contractor is through onboarding, so you can tell whether they are ready to be paid.","tags":["Contractors"],"parameters":[{"name":"email","in":"path","description":"When using email addresses in the URL path, make sure to percent-encode the @ symbol as %40. For example: contractor%40example.com instead of contractor@example.com.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalContractorOnboardingStatus"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"404":{"description":"No contractor with that email has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"security":[{"default":[]}]}},"/external/contractor":{"post":{"operationId":"externalApi_createContractor","summary":"Create Contractor (v1)","description":"Deprecated, use Create Contractor V2 instead. Creates a Pay-As-You-Go contractor only: monthly wage type, flexible rate, zero rate, and no KYC or compliance checks.","tags":["Contractors"],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalSuccessResponse"}}}},"400":{"description":"A field failed validation, for example an invalid ISO 3166-1 alpha-2 country code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"409":{"description":"That contractor already has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalCreateContractorRequest"}}}},"security":[{"default":[]}]}},"/external/contractor/{email}/create-invoice":{"post":{"operationId":"externalApi_createInvoice","summary":"Create Invoice","description":"Creates an invoice against the contractor's contract without paying it. Use this when you want to record work now and settle it on your own schedule.","tags":["Contractors"],"parameters":[{"name":"email","in":"path","description":"When using email addresses in the URL path, make sure to percent-encode the @ symbol as %40. For example: contractor%40example.com instead of contractor@example.com.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalCreateInvoiceResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"404":{"description":"No contractor with that email has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"number","format":"double","description":"Amount in decimals (major and minor unit combined)"},"currency":{"type":"string"},"description":{"type":"string","description":"Description of invoice"}},"required":["amount","currency"]}}}},"security":[{"default":[]}]}},"/external/contractor/{email}/balances":{"get":{"operationId":"externalApi_getContractorBalances","summary":"Get Contractor Balances","description":"Deprecated. Read this from the Thera API with your API key instead. Returns the contractor's withdrawable balance per currency, keyed by ISO 4217 code. These are funds already settled to the contractor that they can withdraw from Thera.","tags":["Contractors"],"parameters":[{"name":"email","in":"path","description":"When using email addresses in the URL path, make sure to percent-encode the @ symbol as %40. For example: contractor%40example.com instead of contractor@example.com.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_GetContractorBalancesResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"404":{"description":"No contractor with that email has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"security":[{"default":[]}]}},"/external/contractor/{email}/contracts":{"get":{"operationId":"externalApi_retrieveAllContractsContractor","summary":"Get Contractor Contracts","description":"Deprecated. Read this from the Thera API with your API key instead. Returns every contract this contractor holds with your company, including inactive ones, with each contract's status and date range.","tags":["Contractors"],"parameters":[{"name":"email","in":"path","description":"Percent-encode @ as %40. Example: contractor%40example.com.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_GetContractsForContractorResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"404":{"description":"No contractor with that email has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"security":[{"default":[]}]}},"/external/contractor/{email}/contract":{"delete":{"operationId":"externalApi_deleteContractorContract","summary":"Delete Contract","description":"Deletes the contractor's contract. Only works when the contractor holds exactly one contract with your company; zero or more than one is an error, so that the call can never delete the wrong contract.","tags":["Contractors"],"parameters":[{"name":"email","in":"path","description":"Percent-encode @ as %40. Example: contractor%40example.com.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ExternalSuccessResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}},"404":{"description":"No contractor with that email has an active API-created contract with your company.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"security":[{"default":[]}]}},"/external/contractors/bulk-details":{"get":{"operationId":"externalApi_retrieveContractorDetails","summary":"Get All Contractors","description":"Deprecated. Read this from the Thera API with your API key instead. Returns every contractor on the account, each with their contracts and invoice history.","tags":["Contractors"],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_GetAllContractorsDetailsResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"security":[{"default":[]}]}},"/external/payment-history":{"get":{"operationId":"externalApi_getPaymentHistory","summary":"Get Payment History","description":"Deprecated. Read this from the Thera API with your API key instead. Returns the payments your company has made to Thera. Each page is newest first by the date the payment took effect, but paging follows the order payments were recorded, so read to the last page before assuming you have the most recent ones.","tags":["Contractors"],"parameters":[{"name":"pageSize","in":"query","description":"How many payments to return. Defaults to 25.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"afterCursor","in":"query","description":"The nextCursor from your previous response.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response with status 200","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_GetPaymentHistoryResponse"}}}},"401":{"description":"The X-Thera-API-Key header is missing, or the key does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/externalApi_ApiErrorBody"}}}}},"deprecated":true,"security":[{"default":[]}]}}},"tags":[{"name":"Contractors"}],"servers":[{"url":"https://api.getthera.com","description":"Production"},{"url":"https://api.staging.getthera.com","description":"Staging"}],"components":{"schemas":{"externalApi_WageType":{"type":"string","enum":["HOURLY","DAILY","MONTHLY","SEMIMONTHLY","BIWEEKLY","WEEKLY","MILESTONE"],"title":"WageType"},"externalApi_DayOfWeek":{"type":"string","enum":["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"],"title":"DayOfWeek"},"externalApi_MonthlyPayCycleEnd":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["dayOfMonth"],"description":"Discriminator value: dayOfMonth"},"value":{"type":"integer"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["lastDayOfMonth"],"description":"Discriminator value: lastDayOfMonth"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["lastDayOfWeekOfMonth"],"description":"Discriminator value: lastDayOfWeekOfMonth"},"value":{"$ref":"#/components/schemas/externalApi_DayOfWeek"}},"required":["type","value"]}],"discriminator":{"propertyName":"type"},"title":"MonthlyPayCycleEnd"},"externalApi_SemiMonthlyPayCycleEnd":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["fifteenthAndEndOfMonth"],"description":"Discriminator value: fifteenthAndEndOfMonth"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["dayOfMonth"],"description":"Discriminator value: dayOfMonth"},"value":{"type":"integer"}},"required":["type","value"],"description":"Between 1 and 14, the 2nd pay cycle of the ends on that day + 15"}],"discriminator":{"propertyName":"type"},"title":"SemiMonthlyPayCycleEnd"},"externalApi_PayCycleEnd":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["weekly"],"description":"Discriminator value: weekly"},"dayOfWeek":{"$ref":"#/components/schemas/externalApi_DayOfWeek"}},"required":["type","dayOfWeek"]},{"type":"object","properties":{"type":{"type":"string","enum":["biweekly"],"description":"Discriminator value: biweekly"},"dayOfWeek":{"$ref":"#/components/schemas/externalApi_DayOfWeek"}},"required":["type","dayOfWeek"]},{"type":"object","properties":{"type":{"type":"string","enum":["monthly"],"description":"Discriminator value: monthly"},"value":{"$ref":"#/components/schemas/externalApi_MonthlyPayCycleEnd"}},"required":["type","value"]},{"type":"object","properties":{"type":{"type":"string","enum":["semimonthly"],"description":"Discriminator value: semimonthly"},"value":{"$ref":"#/components/schemas/externalApi_SemiMonthlyPayCycleEnd"}},"required":["type","value"]}],"discriminator":{"propertyName":"type"},"title":"PayCycleEnd"},"externalApi_PayCycle":{"type":"object","properties":{"cycleStartDate":{"type":"string","format":"date","description":"The contractor's contract's start date"},"cycleEnd":{"$ref":"#/components/schemas/externalApi_PayCycleEnd"},"paymentDueDays":{"type":"integer"},"firstPayDate":{"type":"string","format":"date"},"lastPayDate":{"type":"string","format":"date"},"firstPayTotal":{"type":"integer","format":"int64","description":"In the smallest unit possible. Minor Unit if exists, else use Major Unit. Adheres to [ISO 4217](https://simple.wikipedia.org/wiki/ISO_4217) standard."},"lastPayTotal":{"type":"integer","format":"int64","description":"In the smallest unit possible. Minor Unit if exists, else use Major Unit. Adheres to [ISO 4217](https://simple.wikipedia.org/wiki/ISO_4217) standard."}},"required":["cycleStartDate","cycleEnd","paymentDueDays","firstPayDate"],"title":"PayCycle"},"externalApi_ContractType":{"type":"string","enum":["FIXED_RATE","FLEXIBLE_RATE","MILESTONE","TIME_TRACKING"],"title":"ContractType"},"externalApi_ContractDocumentType":{"type":"string","enum":["NO_CONTRACT","CONTRACT_WIZARD"],"title":"ContractDocumentType"},"externalApi_VerificationSetting":{"type":"object","properties":{"kycEnabled":{"type":"boolean"},"complianceEnabled":{"type":"boolean"}},"required":["kycEnabled","complianceEnabled"],"title":"VerificationSetting"},"externalApi_ExternalCreateContractorRequestV2":{"type":"object","properties":{"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"country":{"type":"string"},"currency":{"type":"string"},"wageType":{"$ref":"#/components/schemas/externalApi_WageType"},"rate":{"type":"integer","format":"int64","description":"In the smallest unit possible. Minor Unit if exists, else use Major Unit. Adheres to [ISO 4217](https://simple.wikipedia.org/wiki/ISO_4217) standard. This field is not needed for Milestone Contractors."},"payCycle":{"$ref":"#/components/schemas/externalApi_PayCycle"},"contractType":{"$ref":"#/components/schemas/externalApi_ContractType"},"contractName":{"type":"string"},"contractDocumentType":{"$ref":"#/components/schemas/externalApi_ContractDocumentType"},"companySigningAuthorityUserId":{"type":"string","description":"The Thera User ID of signer from the company side. Must be an Admin or a Manager."},"verificationSetting":{"$ref":"#/components/schemas/externalApi_VerificationSetting"},"clientCanSubmitWork":{"type":"boolean"},"workerCanSubmitWork":{"type":"boolean"},"scopeOfWork":{"type":"string"},"teamId":{"type":"string","description":"The team the contract is created under, from Get Teams. Required when your company has more than one team; optional when it has exactly one, which is then used automatically."}},"required":["email","firstName","lastName","country","currency","wageType","payCycle","contractType","contractName","contractDocumentType","verificationSetting"],"title":"ExternalCreateContractorRequestV2"},"externalApi_ExternalSuccessResponse":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"title":"ExternalSuccessResponse"},"externalApi_ApiErrorBody":{"type":"object","properties":{"message":{"type":"string"},"displayMessage":{"type":"string","description":"Safe to show an end user. Conflicts return a generic message rather than the specific reason."},"timestamp":{"type":"string","description":"Format dd-MM-yyyy hh:mm:ss."},"type":{"type":"string","description":"Present as GeneralError on 400, 401 and 404. Null on 409."},"debugMessage":{"type":"string"},"subErrors":{"type":"array","items":{"description":"Any type"}}},"required":["message","displayMessage","timestamp"],"description":"The error body every failed request returns.","title":"ApiErrorBody"},"externalApi_Team":{"type":"object","properties":{"teamId":{"type":"string","description":"Pass this as teamId when creating a contractor."},"name":{"type":"string"}},"required":["teamId","name"],"description":"A team on your company.","title":"Team"},"externalApi_GetTeamsResponse":{"type":"object","properties":{"teams":{"type":"array","items":{"$ref":"#/components/schemas/externalApi_Team"}}},"required":["teams"],"description":"Every team on your company.","title":"GetTeamsResponse"},"externalApi_ContractorOnboardingStatus":{"type":"string","enum":["ONBOARDED","SIGN_UP_INCOMPLETE_CONTRACT_NOT_SIGNED","SIGN_UP_INCOMPLETE_CONTRACTOR_NO_ADDRESS"],"title":"ContractorOnboardingStatus"},"externalApi_ExternalContractorOnboardingStatus":{"type":"object","properties":{"email":{"type":"string"},"onboardingStatus":{"$ref":"#/components/schemas/externalApi_ContractorOnboardingStatus"}},"required":["email","onboardingStatus"],"title":"ExternalContractorOnboardingStatus"},"externalApi_ExternalCreateContractorRequest":{"type":"object","properties":{"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"country":{"type":"string"},"currency":{"type":"string"}},"required":["email","firstName","lastName","country","currency"],"title":"ExternalCreateContractorRequest"},"externalApi_ExternalCreateInvoiceResponse":{"type":"object","properties":{"invoiceId":{"type":"string"},"amount":{"type":"number","format":"double"},"currency":{"type":"string"}},"required":["invoiceId","amount","currency"],"title":"ExternalCreateInvoiceResponse"},"externalApi_GetContractorBalancesResponse":{"type":"object","properties":{"balanceByCurrency":{"type":"object","additionalProperties":{"type":"number","format":"double"},"description":"Amount in decimals (major and minor unit combined)"}},"required":["balanceByCurrency"],"title":"GetContractorBalancesResponse"},"externalApi_ContractSummary":{"type":"object","properties":{"contractId":{"type":"string"},"startDate":{"type":"string","description":"Format yyyy-MM-dd"},"endDate":{"type":"string","description":"Null if ongoing"},"status":{"type":"string","description":"Contract status (e.g. ACTIVE, TERMINATED, DRAFT)"}},"required":["contractId","startDate","status"],"title":"ContractSummary"},"externalApi_GetContractsForContractorResponse":{"type":"object","properties":{"userId":{"type":"string","description":"The internal user ID of the contractor."},"contracts":{"type":"array","items":{"$ref":"#/components/schemas/externalApi_ContractSummary"},"description":"List of all contracts associated with this contractor."}},"required":["userId","contracts"],"title":"GetContractsForContractorResponse"},"externalApi_ContractorInvoice":{"type":"object","properties":{"invoiceId":{"type":"string"},"displayId":{"type":"string"},"status":{"type":"string"},"approvalStatus":{"type":"string"},"amount":{"type":"integer","format":"int64"},"currency":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"}},"required":["invoiceId","displayId","status","approvalStatus","amount","currency","startDate","endDate"],"description":"Invoice record","title":"ContractorInvoice"},"externalApi_ContractorContract":{"type":"object","properties":{"contractId":{"type":"string"},"rate":{"type":"integer","format":"int64"},"currency":{"type":"string"},"contractType":{"type":"string"},"displayId":{"type":"string"},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/externalApi_ContractorInvoice"}},"contractStatus":{"type":"string"}},"required":["contractId","rate","currency","contractType","displayId","invoices","contractStatus"],"description":"Contract details with associated invoice history.","title":"ContractorContract"},"externalApi_ContractorDetails":{"type":"object","properties":{"userId":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"country":{"type":"string"},"email":{"type":"string"},"contracts":{"type":"array","items":{"$ref":"#/components/schemas/externalApi_ContractorContract"}}},"required":["userId","firstName","lastName","country","email","contracts"],"description":"Complete contractor profile with associated contracts and invoices.","title":"ContractorDetails"},"externalApi_GetAllContractorsDetailsResponse":{"type":"object","properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/externalApi_ContractorDetails"}}},"required":["users"],"description":"List of all contractors with their contracts and invoice history.","title":"GetAllContractorsDetailsResponse"},"externalApi_ExternalPaymentStatus":{"type":"string","enum":["POSTED","PENDING"],"title":"ExternalPaymentStatus"},"externalApi_ExternalPayment":{"type":"object","properties":{"paymentId":{"type":"string"},"time":{"type":"string","format":"date-time"},"totalAmount":{"type":"integer","format":"int64","description":"Minor units, so 1050 is 10.50. The balances endpoint on this API reports decimals instead."},"currency":{"type":"string","description":"ISO 4217 code."},"status":{"$ref":"#/components/schemas/externalApi_ExternalPaymentStatus"}},"required":["paymentId","time","totalAmount","currency","status"],"title":"ExternalPayment"},"externalApi_GetPaymentHistoryResponse":{"type":"object","properties":{"payments":{"type":"array","items":{"$ref":"#/components/schemas/externalApi_ExternalPayment"}},"nextCursor":{"type":"string","description":"Absent once you have read the last page."}},"required":["payments"],"title":"GetPaymentHistoryResponse"}},"securitySchemes":{"default":{"type":"apiKey","in":"header","name":"X-Thera-API-Key"}}}}