Carta
Carta
Connect Carta so your agents can answer equity questions from the source. For companies, they can read cap tables by share class or stakeholder, stakeholders and their equity, option grants, RSUs, RSAs, certificates, convertible notes, exercises, transaction history, share classes, vesting templates and 409A valuations. For investment firms, they can read funds, investments and their cap tables, holdings, cash balances, performance metrics, partners and their contacts. For shareholders, they can read portfolios, holdings, current fair market values, transactions and fund documents shared with limited partners.
With write access, agents can also book capital calls, management fees and carried interest allocations, draft option grants, record exercise payments and tax withholding, settle secondary transactions, start companies on Carta Launch and upload Open Cap Table files. A fund accounting entry repeated with the same reference is recorded once.
When you sign in, Carta asks which companies, firms or portfolios to share, and your Carta role still limits what agents can see. Your credentials stay on Houston's server.
Setup instructions
Setup instructions
Connect Carta
- Choose Read or Write for Access.
- Select Authorize connection and sign in with your Carta account.
- On Carta's consent screen, choose the companies, firms or portfolios to share, then allow access.
Houston keeps the connection signed in. Carta ends a sign-in that goes unused for 14 days; if requests start failing with an authorization error, select Set up again and sign in.
Advanced
Use your own Carta app
Turn on Use your own Carta app to connect through an app you register with Carta, either in Carta's playground (a shared test environment with sample data that resets daily) or in production. Playground apps are self-serve. Production apps need Carta's review and cannot be edited afterwards; adding permissions later means submitting a new app.
- Register at the Carta Developer Portal (or Login with an existing Carta account), then click Create App.
- Set Grant type to authorization code and add Houston's displayed callback URL under Callbacks.
- Under Scopes, select every scope below. Houston requests the first list for
Read access and both lists for Write access.
- Read:
read_user_info,read_issuer_info,read_issuer_capitalizationtablesummary,read_issuer_stakeholdercapitalizationtable,read_issuer_shareclasses,read_issuer_stakeholders,read_issuer_securities,read_issuer_valuations,read_issuer_securitiestemplates,read_issuer_interests,read_issuer_draftsecurities,read_corporation_info,read_compensation_benchmarks,read_opencaptables,read_investor_firms,read_investor_funds,read_investor_investments,read_investor_capitalizationtables,read_investor_stakeholdercapitalizationtable,read_investor_securities,read_investor_cashbalances,read_investor_fundperformance,read_investor_partners,read_portfolio_info,read_portfolio_securities,read_portfolio_issuervaluations,read_portfolio_transactionsandread_portfolio_fundinvestmentdocuments. - Write:
readwrite_issuer_securities,readwrite_issuer_draftsecurities,readwrite_issuer_secondarytransactions,readwrite_draftissuers,readwrite_opencaptables,readwrite_file_upload,readwrite_investor_capitalcalls,readwrite_investor_carriedinterestandreadwrite_investor_managementfees.
- Read:
- Click Submit, then View app details, and enter the app's
client_idandclient_secretin Houston. - Under Connect using, choose Connect with your Carta app for production or Connect with your Carta playground app for the playground, then select Authorize connection and sign in. In the playground, pick the persona to simulate: Company editor for companies, Investor for firms, Employee for shareholders and Lawyer for Carta Launch.
To use a playground app in production, promote it with Actions → Promote to
production in the Developer Portal and complete Carta's
production review.
Promotion creates a new production app: enter its client_id and client_secret in
Houston, then select Set up again and sign in with Connect with your Carta app.
Carta's fund accounting endpoints (capital calls, management fees, carried interest)
are in beta; ask your Carta representative to enable them for your app before
choosing Write access.
Troubleshooting
- Requested OAuth scopes not granted: the app lacks a scope above, or Carta granted fewer than requested. Add the scopes (a production app needs a new review) and sign in again.
- ACCESS_TO_RESOURCE_RESTRICTED: the company, firm or portfolio wasn't shared at sign-in. Select Set up again and share it.
- MISSING_INTERNAL_PERMISSION: your Carta role doesn't allow that data; ask a company or firm admin in Carta.
Files
Files
connector.luau
-- Carta API Platform v1alpha1. Arguments and results keep Carta's native camelCase field names. type Options = {[string]: any} type Endpoint = {method: string, path: string, query: {string}?, extra: {string}?, required: {string}?, access: string?, body: (boolean | string)?, upload: string?, doc: string, about: string} local PROVIDER = "Carta" local API = if auth.method == "playground" then "https://api.playground.carta.team" else "https://api.carta.com" local DOCS = "https://docs.carta.com/api-platform/reference/v-1-alpha-1-" local PAGE = {"pageSize", "pageToken"} local MODIFIED = {"pageSize", "pageToken", "lastModifiedDatetimeAfter", "lastModifiedDatetimeBefore"} local AS_OF = {"asOfDate", "pageSize", "pageToken"} -- Operations of Carta's API reference, checked on 2026-10-19. Path {fields} are required; -- listed query fields are taken from the options and the other fields form the JSON body of -- POST requests. Writes, and reads that need a readwrite_ scope or return a credential, need access = "data:write". local endpoints: {[string]: Endpoint} = { getCurrentUser = {method = "GET", path = "/v1alpha1/user", doc = "user-get-current-user", about = "{user={id, firstName, lastName, email}}."}, listIssuers = {method = "GET", path = "/v1alpha1/issuers", query = PAGE, doc = "issuers-list-issuers", about = "Companies whose cap tables you can access, {issuers, nextPageToken}."}, getIssuer = {method = "GET", path = "/v1alpha1/issuers/{id}", doc = "issuers-get-issuer", about = "A company."}, listPointsOfContact = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/pointsOfContact", doc = "issuers-list-points-of-contact", about = "The company's contacts."}, getStockSplitChanges = {method = "POST", path = "/v1alpha1/issuers/{issuerId}/securities:stockSplitChanges", required = {"securities", "since"}, doc = "issuers-get-stock-split-asset-changes", about = "Body {securities={{securityType (lowercase: option_grant or certificate), securityId}}, since={value=date-time}}. Whether a stock split changed those securities since then: {affectedAssets, asOf, splitOccurredSince, ...}."}, getIssuerCapitalizationTable = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/capitalizationTable", query = {"asOfDate"}, doc = "issuers-get-capitalization-table", about = "Cap table summary by share class."}, getIssuerStakeholderCapitalizationTable = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/stakeholderCapitalizationTable", query = AS_OF, doc = "issuers-get-stakeholder-capitalization-table", about = "Cap table by stakeholder; pageSize up to 100."}, listShareClasses = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/shareClasses", query = AS_OF, doc = "issuers-list-share-classes", about = ""}, listStakeholders = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/stakeholders", query = PAGE, doc = "issuers-list-stakeholders", about = "People and entities holding securities; pageSize up to 100."}, getStakeholder = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/stakeholders/{id}", doc = "issuers-get-stakeholder", about = ""}, getStakeholderEquitySummary = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/stakeholders/{stakeholderId}/equitySummary", query = {"asOfDate", "includeCanceled"}, doc = "issuers-get-stakeholder-equity-summary", about = "A stakeholder's certificates, options, RSAs and RSUs."}, listFairMarketValues = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/fairMarketValues", query = PAGE, doc = "issuers-list-fair-market-values", about = "409A valuations."}, listVestingScheduleTemplates = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/vestingScheduleTemplates", query = PAGE, doc = "issuers-list-vesting-schedule-templates", about = ""}, listInterests = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/interests", query = AS_OF, doc = "issuers-list-interests", about = "LLC interests; pageSize default and maximum 100."}, listTransactions = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/transactions", query = {"type", "pageSize", "pageToken"}, required = {"type"}, doc = "issuers-list-transactions", about = "Security history. type: option, rsu, rsa, certificate, warrant, convertible, piu, sar or phantom; pageSize default 50, up to 1000."}, listCertificates = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/certificates", query = MODIFIED, doc = "issuers-list-certificates", about = "Share certificates."}, getCertificate = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/certificates/{id}", doc = "issuers-get-certificate", about = ""}, listConvertibleNotes = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/convertibleNotes", query = PAGE, doc = "issuers-list-convertible-notes", about = "Convertible notes and SAFEs."}, getConvertibleNote = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/convertibleNotes/{id}", doc = "issuers-get-convertible-note", about = ""}, listOptionGrants = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/optionGrants", query = MODIFIED, doc = "issuers-list-option-grants", about = ""}, getOptionGrant = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/optionGrants/{id}", doc = "issuers-get-option-grant", about = ""}, listRestrictedStockAwards = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/restrictedStockAwards", query = MODIFIED, doc = "issuers-list-restricted-stock-awards", about = ""}, getRestrictedStockAward = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/restrictedStockAwards/{id}", doc = "issuers-get-restricted-stock-award", about = ""}, listRestrictedStockUnits = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/restrictedStockUnits", query = MODIFIED, doc = "issuers-list-restricted-stock-units", about = ""}, getRestrictedStockUnit = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/restrictedStockUnits/{id}", doc = "issuers-get-restricted-stock-unit", about = ""}, listOptionExercises = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/optionExercises", query = PAGE, doc = "issuers-list-option-exercises", about = "pageSize up to 100."}, updateExerciseMoneyMovement = {method = "POST", path = "/v1alpha1/issuers/{issuerId}/optionExercises/{exerciseId}:updateMoneyMovement", access = "data:write", doc = "issuers-update-money-movement", about = "Body {moneyMovement={completionDate={value=date}}}: when the exercise funds were received."}, updateExerciseTaxWithholding = {method = "POST", path = "/v1alpha1/issuers/{issuerId}/optionExercises/{exerciseId}:updateTaxWithholding", access = "data:write", doc = "issuers-update-tax-withholding", about = "Body {taxWithholdings={{name, rate={value}, taxes=money, jurisdiction={country={value}, countrySubdivision?={value}, city?}}}}."}, createDraftOptionGrant = {method = "POST", path = "/v1alpha1/issuers/{issuerId}/draftOptionGrantSets/{draftOptionGrantSetId}/draftOptionGrants", access = "data:write", required = {"draftOptionGrant"}, doc = "issuers-draftsecurities-create-draft-option-grant", about = "Body {draftOptionGrant}; see the reference for its fields (dates are {year, month, day}). A grant awaiting board approval; vesting templates come from listVestingScheduleTemplates."}, getDraftOptionGrant = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/draftOptionGrantSets/{draftOptionGrantSetId}/draftOptionGrants/{draftOptionGrantId}", doc = "issuers-draftsecurities-get-draft-option-grant", about = ""}, initiateSecondarySettlement = {method = "POST", path = "/v1alpha1/issuers/{issuerId}/secondaryTransactions", access = "data:write", required = {"externalReferenceId", "rightOfFirstRefusalOutcome", "pricePerShare", "securities"}, doc = "issuers-initiate-settlement", about = "Body {externalReferenceId, rightOfFirstRefusalOutcome, pricePerShare=money, securities={{securityType (option_grant or certificate), securityId, stockOptionType? (ISO or NSO), quantity={value}}}, buyerInformation?}; buyerInformation is required for WAIVED and EXERCISED_BY_STAKEHOLDER. Soft-locks the securities; keep secondaryTransactionId and follow transactionState."}, getSecondaryTransaction = {method = "GET", path = "/v1alpha1/issuers/{issuerId}/secondaryTransactions/{secondaryTransactionId}", access = "data:write", doc = "issuers-get-secondary-transaction", about = "State and per-security settlement outcome, including tax withholding."}, finalizeSecondarySettlement = {method = "POST", path = "/v1alpha1/issuers/{issuerId}/secondaryTransactions/{secondaryTransactionId}:finalize", access = "data:write", doc = "issuers-finalize-settlement", about = "Body {securities?={{securityId, stockOptionType?, taxLineItems?}}}. Confirms all money movement (irreversible) is complete; the issuer still approves before the cap table changes."}, listCorporations = {method = "GET", path = "/v1alpha1/corporations", query = PAGE, doc = "corporations-list-corporations", about = "Corporations for Carta Total Compensation."}, getCompensationBenchmarkAttributes = {method = "GET", path = "/v1alpha1/corporations/{corporationId}/compensationBenchmarkAttributes", doc = "compensation-get-compensation-benchmark-attributes", about = "Valid values for the benchmark filters."}, getCompensationBenchmarks = {method = "GET", path = "/v1alpha1/corporations/{corporationId}/compensationBenchmarks", query = {"postMoneyValuationBucket", "geoAdjustmentLocation", "jobArea", "compensationType", "jobSpecialization", "jobLevel", "pageSize", "pageToken"}, required = {"postMoneyValuationBucket", "geoAdjustmentLocation", "jobArea"}, doc = "compensation-get-compensation-benchmarks", about = "pageSize default and maximum 100."}, createDraftIssuer = {method = "POST", path = "/v1alpha1/draftIssuers", access = "data:write", doc = "draft-issuers-create-draft-issuer", about = "Body {draftIssuer}; see the reference for its fields. Starts a company on Carta Launch; the result's registrationUrl is a one-time link for its primary contact."}, getDraftIssuer = {method = "GET", path = "/v1alpha1/draftIssuers/{id}", access = "data:write", doc = "draft-issuers-get-draft-issuer", about = "Includes the primary contact's one-time registrationUrl; treat it as a secret."}, uploadOpenCapTable = {method = "POST", path = "/v1alpha1/openCapTables", access = "data:write", extra = {"path"}, required = {"path"}, body = false, upload = "application/zip", doc = "open-cap-tables-upload-open-cap-table", about = "Sends the OCF ZIP archive at session file path as the raw body. Carta stores submissions during its beta; getOpenCapTable reports state."}, getOpenCapTable = {method = "GET", path = "/v1alpha1/openCapTables/{id}", doc = "open-cap-tables-get-open-cap-table", about = "Processing status of an OCF upload."}, uploadFile = {method = "POST", path = "/v1alpha1/files:upload", access = "data:write", required = {"file"}, doc = "files-upload-file", about = "Body {file={filePayload (base64, at most 3.5 MiB), uploadDetails={name, description?, tags?}}}."}, listFirms = {method = "GET", path = "/v1alpha1/investors/firms", query = PAGE, doc = "investors-list-firms", about = "Investment firms you can access."}, listFunds = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds", query = PAGE, doc = "investors-list-funds", about = ""}, listInvestments = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments", query = PAGE, doc = "investors-list-investments", about = "Portfolio companies with cap table data on Carta."}, listInvestmentCapitalizationTables = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{companyId}/capitalizationTables", query = PAGE, doc = "investors-list-capitalization-tables", about = ""}, getInvestmentCapitalizationTable = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{companyId}/capitalizationTables/{capitalizationTableId}", query = {"asOfDate"}, doc = "investors-get-capitalization-table", about = "capitalizationTableId = companyId selects the primary cap table."}, getInvestmentStakeholderCapitalizationTable = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{companyId}/stakeholderCapitalizationTables/{capitalizationTableId}", query = AS_OF, doc = "investors-get-stakeholder-capitalization-table", about = "capitalizationTableId = companyId selects the primary cap table."}, listInvestmentCertificates = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{investmentId}/certificates", query = {"asOfDate", "pageSize", "pageToken", "lastModifiedDatetimeAfter", "lastModifiedDatetimeBefore"}, doc = "investors-list-certificates", about = "pageSize up to 100."}, listInvestmentConvertibleNotes = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{investmentId}/convertibleNotes", query = AS_OF, doc = "investors-list-convertible-notes", about = "Convertible notes and SAFEs; pageSize up to 100."}, listInvestmentWarrants = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{investmentId}/warrants", query = AS_OF, doc = "investors-list-warrants", about = "pageSize up to 100."}, listCashBalances = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/cashBalances", query = {"asOfDateTime", "pageSize", "pageToken"}, doc = "investors-list-cash-balances", about = ""}, listFundPerformanceMetrics = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/metrics", query = {"asOfDateTime", "reportType", "pageSize", "pageToken"}, doc = "investors-list-fund-performance-metrics", about = "reportType: BY_FUND, BY_PARTNER_TYPE or BY_PARTNER."}, listFirmPerformanceMetrics = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/metrics", query = {"fundIds", "asOfDateTime", "groupBy", "pageSize", "pageToken"}, doc = "investors-list-firm-performance-metrics", about = "Aggregated across funds. groupBy: AGGREGATION_TYPE_BY_PARTNER_TYPE or AGGREGATION_TYPE_BY_PARTNER_GROUP."}, listPartners = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/partners", query = {"fundIds", "groupId", "pageSize", "pageToken"}, doc = "investors-list-partners", about = "LPs and GPs across funds; pageSize default 50, up to 100."}, listPartnerContacts = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/partnerContacts", query = {"fundIds", "partnerIds", "pageSize", "pageToken"}, doc = "investors-list-partner-contacts", about = "pageSize default 50, up to 100."}, listFundInterests = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/interests", query = PAGE, doc = "investors-list-fund-interests", about = "Partner interests; their id is the interestId the accounting writes take. pageSize default 50, up to 100."}, createCapitalCall = {method = "POST", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/capitalCalls", access = "data:write", required = {"externalReferenceId", "sourceSystem", "dueDate", "amount", "postAsDraft"}, doc = "investors-create-capital-call", about = "Body {externalReferenceId, sourceSystem, dueDate={value=date}, amount={value=decimal}, postAsDraft, interestIds?, purpose?, paymentDetailsId?}. Allocates the amount across the fund's interests (all when interestIds is empty). postAsDraft=false releases the call, posts its journal and may email partners; prefer true."}, getCapitalCall = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/capitalCalls/{capitalCallId}", access = "data:write", doc = "investors-get-capital-call", about = "Status and allocation."}, adjustCapitalCall = {method = "POST", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/capitalCalls/{capitalCallId}:adjust", access = "data:write", required = {"externalReferenceId", "sourceSystem", "amount"}, doc = "investors-adjust-capital-call", about = "Body {externalReferenceId, sourceSystem, amount={value=decimal}, note?}. Changes the total of an unreleased call and reallocates it."}, createCarriedInterestAllocation = {method = "POST", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/carriedInterestAllocations", access = "data:write", required = {"externalReferenceId", "sourceSystem", "effectiveDate", "deltas"}, doc = "investors-create-carried-interest-allocation", about = "Body {externalReferenceId, sourceSystem, effectiveDate={value=date}, deltas={{interestId, amount={value=decimal}}}, notes?}; deltas net to zero with at most 2 decimals. Books carried interest calculated outside Carta."}, createManagementFee = {method = "POST", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/managementFees", access = "data:write", required = {"externalReferenceId", "sourceSystem", "periodStart", "periodEnd", "effectiveDate", "amount", "interestAmounts"}, doc = "investors-create-management-fee", about = "Body {externalReferenceId, sourceSystem, periodStart, periodEnd, effectiveDate (each {value=date}), amount=money, interestAmounts={{interestId, amount={value=decimal}}}}; interestAmounts sum to amount. Posts the fee journal."}, getManagementFee = {method = "GET", path = "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/managementFees/{managementFeeId}", access = "data:write", doc = "investors-get-management-fee", about = "A fee booked by createManagementFee, with its journal state."}, listPortfolios = {method = "GET", path = "/v1alpha1/portfolios", query = PAGE, doc = "portfolios-issuers-list-portfolios", about = "Your shareholder portfolios."}, getPortfolio = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}", doc = "portfolios-issuers-get-portfolio", about = ""}, listPortfolioIssuers = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers", query = PAGE, doc = "portfolios-issuers-list-portfolio-issuers", about = "Companies you hold securities in."}, getPortfolioFairMarketValue = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/fairMarketValue", doc = "portfolios-issuers-get-fair-market-value", about = "Current 409A value."}, listPortfolioCertificates = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/certificates", query = MODIFIED, doc = "portfolios-issuers-list-certificates", about = ""}, getPortfolioCertificate = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/certificates/{certificateId}", doc = "portfolios-issuers-get-certificate", about = ""}, listPortfolioConvertibleNotes = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/convertibleNotes", query = PAGE, doc = "portfolios-issuers-list-convertible-notes", about = "pageSize up to 100."}, getPortfolioConvertibleNote = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/convertibleNotes/{id}", doc = "portfolios-issuers-get-convertible-note", about = ""}, listPortfolioOptionGrants = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/optionGrants", query = MODIFIED, doc = "portfolios-issuers-list-option-grants", about = ""}, getPortfolioOptionGrant = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/optionGrants/{optionGrantId}", doc = "portfolios-issuers-get-option-grant", about = ""}, listPortfolioRestrictedStockAwards = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockAwards", query = MODIFIED, doc = "portfolios-issuers-list-restricted-stock-awards", about = ""}, getPortfolioRestrictedStockAward = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockAwards/{restrictedStockAwardId}", doc = "portfolios-issuers-get-restricted-stock-award", about = ""}, listPortfolioRestrictedStockUnits = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockUnits", query = MODIFIED, doc = "portfolios-issuers-list-restricted-stock-units", about = ""}, getPortfolioRestrictedStockUnit = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockUnits/{restrictedStockUnitId}", doc = "portfolios-issuers-get-restricted-stock-unit", about = ""}, listPortfolioSecurityTransactions = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/securityTransactions", query = PAGE, doc = "portfolios-issuers-list-security-transactions", about = "Exercises, sales and settlements, {securitytransactions, nextPageToken}; pageSize default 50, up to 1000."}, listFundInvestmentDocuments = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/fundInvestmentDocuments", query = {"fundId", "effectiveDateAfter", "effectiveDateBefore", "sharedDateAfter", "sharedDateBefore", "pageSize", "pageToken"}, doc = "portfolios-list-fund-investment-documents", about = "Documents funds shared with you as a limited partner."}, getFundInvestmentDocumentUrl = {method = "GET", path = "/v1alpha1/portfolios/{portfolioId}/fundInvestmentDocuments/{documentId}:download", doc = "portfolios-download-fund-investment-document", about = "{downloadUrl, downloadUrlExpirationTime}: a temporary signed link; treat it as a secret."}, } -- Request layer shared verbatim by the endpoint-table connectors -- (tools/validate checks they match). It uses each connector's PROVIDER, DOCS and Endpoint type. local NULL = json.decode("null") local NONE: {string} = table.freeze({}) local function options(input: Options?): Options if input == nil then return {} end assert(type(input) == "table", "opts must be an object") for key in input do assert(type(key) == "string", "opts must have named fields") end return table.clone(input) end local function scalar(value: any, field: string): string local kind = type(value) assert(kind == "string" or kind == "boolean" or kind == "number", field .. " must be a string, boolean, number or array of those") return url.encode(value) end -- A query value's encoded parts: one for a scalar, one per item of a nonempty array. Each -- connector joins them as its provider expects, comma-separated or with the key repeated. local function queryParts(value: any, field: string): {string} if type(value) ~= "table" then return {scalar(value, field)} end local parts: {string} = {} for index, item in value do assert(type(index) == "number" and index == #parts + 1, field .. " must be an array, not an object") table.insert(parts, scalar(item, field)) end assert(#parts > 0, field .. " must not be an empty array") return parts end -- POST, PATCH and PUT send the remaining options as the JSON body unless body is false -- (no body) or names the one option to send. local function hasBody(endpoint: Endpoint): boolean return endpoint.body ~= false and (endpoint.method == "POST" or endpoint.method == "PATCH" or endpoint.method == "PUT") end local function fail(name: string, response: HttpResponse, message: string): never return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode, retryable = response.statusCode == 429 or response.statusCode >= 500, message = message}) end -- A successful response's JSON object, or nil when a write answers without a body. With arrays, -- a top-level JSON array is accepted too, and the second result tells which one came back. local function object(name: string, endpoint: Endpoint, response: HttpResponse, arrays: boolean?): (any, boolean) local raw = await(response.body:readAll()) if endpoint.method ~= "GET" and endpoint.access and string.match(raw, "^%s*$") then return nil, false end local ok, value = pcall(json.decode, raw) local list = arrays == true and string.match(raw, "^%s*%[") ~= nil if not ok or type(value) ~= "table" or not (list or string.match(raw, "^%s*{")) then fail(name, response, PROVIDER .. " returned an invalid JSON object") end return value, list end -- name({path fields, query fields?, extra fields?, required body fields, ...body}) built from the -- endpoint itself. -- Extra fields are options the connector's own request consumes, such as a request header. local function signature(endpoint: Endpoint): string local fields: {string} = {} for field in string.gmatch(endpoint.path, "{([%w_]+)}") do table.insert(fields, field) end for _, group in {endpoint.query or NONE, endpoint.extra or NONE} do for _, field in group do table.insert(fields, if table.find(endpoint.required or NONE, field) then field else field .. "?") end end if type(endpoint.body) == "string" then table.insert(fields, endpoint.body) elseif hasBody(endpoint) then for _, field in endpoint.required or NONE do if not table.find(fields, field) then table.insert(fields, field) end end table.insert(fields, "...body") end return "({" .. table.concat(fields, ", ") .. "})" end -- A function for each endpoint the connection's access allows, and help listing them after intro. local function operations(endpoints: {[string]: Endpoint}, request: (string, Endpoint, Options?) -> any, intro: {string}): {[string]: any} local exports: {[string]: any} = {} for name, endpoint in endpoints do if not endpoint.access or houston.allows(endpoint.access) then exports[name] = function(args: Options?): any return request(name, endpoint, args) end end end exports.help = function(): string local names: {string} = {} for name in exports do if name ~= "help" then table.insert(names, name) end end table.sort(names) local lines = table.clone(intro) table.insert(lines, "Each function below names its route and reference page, " .. DOCS .. "<page>.") for _, name in names do local endpoint = endpoints[name] table.insert(lines, name .. signature(endpoint) .. ": " .. endpoint.about .. " " .. endpoint.method .. " " .. endpoint.path .. " (" .. endpoint.doc .. ")") end return table.concat(lines, "\n") end return exports end -- End of the shared request layer. -- Carta IDs are numeric strings, UUIDs or short IDs; "-" selects every fund of a firm. local function identifier(value: any, field: string): string if type(value) == "number" then assert(value >= 0 and value % 1 == 0 and value <= 9007199254740991, field .. " must be a Carta ID") return string.format("%d", value) end assert(type(value) == "string" and string.match(value, "^[%w_%-]+$") and #value <= 64, field .. " must be a Carta ID") return value end -- Carta errors are google.rpc.Status objects {code, message, details=[{reason}]}; a rate -- limit answers {message}, and a missing token plain text. local function failStatus(name: string, response: HttpResponse): never local message = "Carta HTTP " .. tostring(response.statusCode) local ok, value = pcall(json.decode, await(response.body:readPrefix(16 * 1024))) if ok and type(value) == "table" then local reasons: {string} = {} if type(value.details) == "table" then for _, detail in value.details do if type(detail) == "table" and type(detail.reason) == "string" then table.insert(reasons, detail.reason) end end end if #reasons > 0 then message ..= " (" .. string.sub(table.concat(reasons, ", "), 1, 200) .. ")" end if type(value.message) == "string" then message ..= ": " .. string.sub(value.message, 1, 600) end end local reset = response.headers["ratelimit-reset"] if response.statusCode == 429 and reset and reset[1] then message ..= "; rate limit resets in " .. reset[1] .. "s" end return fail(name, response, message) end local function request(name: string, endpoint: Endpoint, input: Options?): any local args = options(input) local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string) local id = identifier(args[field], field) args[field] = nil return id end) for _, field in endpoint.required or NONE do assert(args[field] ~= nil and args[field] ~= NULL, field .. " is required") end local query: {string} = {} -- Carta reads list filters (fundIds, partnerIds) as comma-separated values. for _, field in endpoint.query or NONE do if args[field] ~= nil then table.insert(query, field .. "=" .. table.concat(queryParts(args[field], field), ",")) end args[field] = nil end if #query > 0 then path ..= "?" .. table.concat(query, "&") end local headers: HttpHeaders = {Accept = {"application/json"}} local extra: Options = {} for _, field in endpoint.extra or NONE do extra[field], args[field] = args[field], nil end local body: (string | File)? = nil if hasBody(endpoint) then headers["Content-Type"] = {"application/json"} body = json.encode(args) args = {} end local unknown = next(args) assert(unknown == nil, name .. " has no option " .. tostring(unknown)) -- uploadOpenCapTable streams the session file at path as the raw body. if endpoint.upload then assert(type(extra.path) == "string" and extra.path ~= "", "path must be a session file path") assert(await(fs.stat(extra.path)).isFile, "path must be a session file") headers["Content-Type"] = {endpoint.upload} body = fs.open(extra.path, "r") end local response = await(http.request({method = endpoint.method, url = API .. path, headers = headers, body = body})) if response.statusCode < 200 or response.statusCode >= 300 then failStatus(name, response) end -- Accepted settlements may answer 202 without a body. return object(name, endpoint, response) or {success = true} end return operations(endpoints, request, { "Carta API Platform v1alpha1" .. (if auth.method == "playground" then " on the playground (shared test data that resets daily)" else "") .. ". Every function takes one named options object with Carta's camelCase names; ? marks optional fields and ...body the JSON body fields. Results are Carta's JSON unchanged, such as {issuers, nextPageToken}; a write answered without a body returns {success=true}. Connector calls return completed values: use them directly, without await.", "Start from listIssuers() for companies, listFirms() then listFunds({firmId}) for investment firms (fundId '-' selects every fund for cash balances, metrics and investment securities, and investmentId '-' every investment for those securities), or listPortfolios() for shareholdings. Only the companies, firms and portfolios shared at sign-in are visible, within the user's Carta role.", "IDs are strings. Lists return one page: pageSize defaults to 25, at most 50 unless noted (larger values are reduced); while nextPageToken is nonempty, pass it as pageToken with the same other options. Query dates are YYYY-MM-DD and date-times ISO 8601 UTC. In bodies Carta wraps scalars: a date or date-time is {value='2026-11-01'}, a decimal {value='2500.00'}, money {currencyCode={value='USD'}, amount={value='2500.00'}}. Array filters (fundIds, partnerIds) are sent comma-separated.", "Examples: local issuer = carta.listIssuers({pageSize=50}).issuers[1]; carta.getIssuerCapitalizationTable({issuerId=issuer.id, asOfDate='2026-10-19'}); carta.listStakeholders({issuerId=issuer.id, pageSize=100}); carta.listTransactions({issuerId=issuer.id, type='option'}); carta.listFundPerformanceMetrics({firmId=firm.id, fundId='-', reportType='BY_FUND'}).", "Read-only connections omit writes, getCapitalCall, getManagementFee and getSecondaryTransaction, which need write scopes, and getDraftIssuer, whose registration link is a credential. Fund accounting writes are idempotent on externalReferenceId and sourceSystem: repeating the same request returns the original with replayed=true, and a different payload under the same reference fails with 409. Other writes are not: after a timeout or 5xx, check whether the write took effect (read or list the resource, or look in Carta) before repeating it. Carta allows 10 requests per second and 300 per minute (half on the playground).", "Errors report the HTTP status, Carta's reasons (INSUFFICIENT_SCOPE, ACCESS_TO_RESOURCE_RESTRICTED for a resource not shared at sign-in, MISSING_INTERNAL_PERMISSION for the user's Carta role) and message.", })houston.json
{ "schema_version": 2, "name": "Carta", "files": [ "connector.luau" ], "icon": "icon.svg", "access": [ { "name": "data", "label": "Access", "levels": [ { "value": "read", "label": "Read" }, { "value": "write", "label": "Write" } ], "default": "read" } ], "config": { "own_app": { "default": false, "label": "Use your own Carta app", "order": 1, "type": "boolean" }, "client_id": { "if": "{{ is config.own_app true }}", "label": "Carta OAuth client ID", "order": 2, "required": true, "type": "string" }, "client_secret": { "if": "{{ is config.own_app true }}", "label": "Carta OAuth client secret", "order": 3, "required": true, "type": "secret" } }, "auth": { "carta": { "type": "oauth2", "label": "Connect with Carta", "if": "{{ is config.own_app false }}", "authorize_url": "https://login.app.carta.com/o/authorize/", "token_url": "https://login.app.carta.com/o/access_token/", "client_id": "{{publisher.client_id}}", "client_secret": "{{publisher.client_secret}}", "client_auth": "basic", "require_refresh": true, "scopes": [ { "values": [ "read_user_info", "read_issuer_info", "read_issuer_capitalizationtablesummary", "read_issuer_stakeholdercapitalizationtable", "read_issuer_shareclasses", "read_issuer_stakeholders", "read_issuer_securities", "read_issuer_valuations", "read_issuer_securitiestemplates", "read_issuer_interests", "read_issuer_draftsecurities", "read_corporation_info", "read_compensation_benchmarks", "read_opencaptables", "read_investor_firms", "read_investor_funds", "read_investor_investments", "read_investor_capitalizationtables", "read_investor_stakeholdercapitalizationtable", "read_investor_securities", "read_investor_cashbalances", "read_investor_fundperformance", "read_investor_partners", "read_portfolio_info", "read_portfolio_securities", "read_portfolio_issuervaluations", "read_portfolio_transactions", "read_portfolio_fundinvestmentdocuments" ] }, { "if": "{{ allows access.data \"write\" }}", "values": [ "readwrite_issuer_securities", "readwrite_issuer_draftsecurities", "readwrite_issuer_secondarytransactions", "readwrite_draftissuers", "readwrite_opencaptables", "readwrite_file_upload", "readwrite_investor_capitalcalls", "readwrite_investor_carriedinterest", "readwrite_investor_managementfees" ] } ], "account": { "url": "https://api.carta.com/v1alpha1/user", "headers": { "Authorization": { "value": "Bearer {{auth.carta.access_token}}" } }, "label": "/user/email" } }, "own_app": { "type": "oauth2", "label": "Connect with your Carta app", "order": 1, "if": "{{ is config.own_app true }}", "authorize_url": "https://login.app.carta.com/o/authorize/", "token_url": "https://login.app.carta.com/o/access_token/", "client_id": "{{config.client_id}}", "client_secret": "{{config.client_secret}}", "client_auth": "basic", "require_refresh": true, "scopes": [ { "values": [ "read_user_info", "read_issuer_info", "read_issuer_capitalizationtablesummary", "read_issuer_stakeholdercapitalizationtable", "read_issuer_shareclasses", "read_issuer_stakeholders", "read_issuer_securities", "read_issuer_valuations", "read_issuer_securitiestemplates", "read_issuer_interests", "read_issuer_draftsecurities", "read_corporation_info", "read_compensation_benchmarks", "read_opencaptables", "read_investor_firms", "read_investor_funds", "read_investor_investments", "read_investor_capitalizationtables", "read_investor_stakeholdercapitalizationtable", "read_investor_securities", "read_investor_cashbalances", "read_investor_fundperformance", "read_investor_partners", "read_portfolio_info", "read_portfolio_securities", "read_portfolio_issuervaluations", "read_portfolio_transactions", "read_portfolio_fundinvestmentdocuments" ] }, { "if": "{{ allows access.data \"write\" }}", "values": [ "readwrite_issuer_securities", "readwrite_issuer_draftsecurities", "readwrite_issuer_secondarytransactions", "readwrite_draftissuers", "readwrite_opencaptables", "readwrite_file_upload", "readwrite_investor_capitalcalls", "readwrite_investor_carriedinterest", "readwrite_investor_managementfees" ] } ], "account": { "url": "https://api.carta.com/v1alpha1/user", "headers": { "Authorization": { "value": "Bearer {{auth.own_app.access_token}}" } }, "label": "/user/email" } }, "playground": { "type": "oauth2", "label": "Connect with your Carta playground app", "order": 2, "if": "{{ is config.own_app true }}", "authorize_url": "https://login.playground.carta.team/o/authorize/", "token_url": "https://login.playground.carta.team/o/access_token/", "client_id": "{{config.client_id}}", "client_secret": "{{config.client_secret}}", "client_auth": "basic", "require_refresh": true, "scopes": [ { "values": [ "read_user_info", "read_issuer_info", "read_issuer_capitalizationtablesummary", "read_issuer_stakeholdercapitalizationtable", "read_issuer_shareclasses", "read_issuer_stakeholders", "read_issuer_securities", "read_issuer_valuations", "read_issuer_securitiestemplates", "read_issuer_interests", "read_issuer_draftsecurities", "read_corporation_info", "read_compensation_benchmarks", "read_opencaptables", "read_investor_firms", "read_investor_funds", "read_investor_investments", "read_investor_capitalizationtables", "read_investor_stakeholdercapitalizationtable", "read_investor_securities", "read_investor_cashbalances", "read_investor_fundperformance", "read_investor_partners", "read_portfolio_info", "read_portfolio_securities", "read_portfolio_issuervaluations", "read_portfolio_transactions", "read_portfolio_fundinvestmentdocuments" ] }, { "if": "{{ allows access.data \"write\" }}", "values": [ "readwrite_issuer_securities", "readwrite_issuer_draftsecurities", "readwrite_issuer_secondarytransactions", "readwrite_draftissuers", "readwrite_opencaptables", "readwrite_file_upload", "readwrite_investor_capitalcalls", "readwrite_investor_carriedinterest", "readwrite_investor_managementfees" ] } ], "account": { "url": "https://api.playground.carta.team/v1alpha1/user", "headers": { "Authorization": { "value": "Bearer {{auth.playground.access_token}}" } }, "label": "/user/email" } } }, "publisher": { "client_id": { "label": "Carta OAuth client ID", "order": 1, "type": "string" }, "client_secret": { "label": "Carta OAuth client secret", "order": 2, "type": "secret" } }, "proxy": [ { "match": { "protocol": "http", "host": [ "api.carta.com", "api.playground.carta.team" ], "method": [ "GET" ], "path": [ "/v1alpha1/corporations", "/v1alpha1/corporations/{corporationId}/compensationBenchmarkAttributes", "/v1alpha1/corporations/{corporationId}/compensationBenchmarks", "/v1alpha1/investors/firms", "/v1alpha1/investors/firms/{firmId}/funds", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/cashBalances", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/interests", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{companyId}/capitalizationTables", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{companyId}/capitalizationTables/{capitalizationTableId}", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{companyId}/stakeholderCapitalizationTables/{capitalizationTableId}", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{investmentId}/certificates", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{investmentId}/convertibleNotes", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/investments/{investmentId}/warrants", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/metrics", "/v1alpha1/investors/firms/{firmId}/metrics", "/v1alpha1/investors/firms/{firmId}/partnerContacts", "/v1alpha1/investors/firms/{firmId}/partners", "/v1alpha1/issuers", "/v1alpha1/issuers/{id}", "/v1alpha1/issuers/{issuerId}/capitalizationTable", "/v1alpha1/issuers/{issuerId}/certificates", "/v1alpha1/issuers/{issuerId}/certificates/{id}", "/v1alpha1/issuers/{issuerId}/convertibleNotes", "/v1alpha1/issuers/{issuerId}/convertibleNotes/{id}", "/v1alpha1/issuers/{issuerId}/draftOptionGrantSets/{draftOptionGrantSetId}/draftOptionGrants/{draftOptionGrantId}", "/v1alpha1/issuers/{issuerId}/fairMarketValues", "/v1alpha1/issuers/{issuerId}/interests", "/v1alpha1/issuers/{issuerId}/optionExercises", "/v1alpha1/issuers/{issuerId}/optionGrants", "/v1alpha1/issuers/{issuerId}/optionGrants/{id}", "/v1alpha1/issuers/{issuerId}/pointsOfContact", "/v1alpha1/issuers/{issuerId}/restrictedStockAwards", "/v1alpha1/issuers/{issuerId}/restrictedStockAwards/{id}", "/v1alpha1/issuers/{issuerId}/restrictedStockUnits", "/v1alpha1/issuers/{issuerId}/restrictedStockUnits/{id}", "/v1alpha1/issuers/{issuerId}/shareClasses", "/v1alpha1/issuers/{issuerId}/stakeholderCapitalizationTable", "/v1alpha1/issuers/{issuerId}/stakeholders", "/v1alpha1/issuers/{issuerId}/stakeholders/{id}", "/v1alpha1/issuers/{issuerId}/stakeholders/{stakeholderId}/equitySummary", "/v1alpha1/issuers/{issuerId}/transactions", "/v1alpha1/issuers/{issuerId}/vestingScheduleTemplates", "/v1alpha1/openCapTables/{id}", "/v1alpha1/portfolios", "/v1alpha1/portfolios/{portfolioId}", "/v1alpha1/portfolios/{portfolioId}/fundInvestmentDocuments", "/v1alpha1/portfolios/{portfolioId}/fundInvestmentDocuments/{documentId}:download", "/v1alpha1/portfolios/{portfolioId}/issuers", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/certificates", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/certificates/{certificateId}", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/convertibleNotes", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/convertibleNotes/{id}", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/fairMarketValue", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/optionGrants", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/optionGrants/{optionGrantId}", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockAwards", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockAwards/{restrictedStockAwardId}", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockUnits", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/restrictedStockUnits/{restrictedStockUnitId}", "/v1alpha1/portfolios/{portfolioId}/issuers/{issuerId}/securityTransactions", "/v1alpha1/user" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.carta.access_token || auth.own_app.access_token || auth.playground.access_token}}" } } } }, { "match": { "protocol": "http", "host": [ "api.carta.com", "api.playground.carta.team" ], "method": [ "POST" ], "path": [ "/v1alpha1/issuers/{issuerId}/securities:stockSplitChanges" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.carta.access_token || auth.own_app.access_token || auth.playground.access_token}}" } } } }, { "if": "{{ allows access.data \"write\" }}", "match": { "protocol": "http", "host": [ "api.carta.com", "api.playground.carta.team" ], "method": [ "GET" ], "path": [ "/v1alpha1/draftIssuers/{id}", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/capitalCalls/{capitalCallId}", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/managementFees/{managementFeeId}", "/v1alpha1/issuers/{issuerId}/secondaryTransactions/{secondaryTransactionId}" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.carta.access_token || auth.own_app.access_token || auth.playground.access_token}}" } } } }, { "if": "{{ allows access.data \"write\" }}", "match": { "protocol": "http", "host": [ "api.carta.com", "api.playground.carta.team" ], "method": [ "POST" ], "path": [ "/v1alpha1/draftIssuers", "/v1alpha1/files:upload", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/capitalCalls", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/capitalCalls/{capitalCallId}:adjust", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/carriedInterestAllocations", "/v1alpha1/investors/firms/{firmId}/funds/{fundId}/managementFees", "/v1alpha1/issuers/{issuerId}/draftOptionGrantSets/{draftOptionGrantSetId}/draftOptionGrants", "/v1alpha1/issuers/{issuerId}/optionExercises/{exerciseId}:updateMoneyMovement", "/v1alpha1/issuers/{issuerId}/optionExercises/{exerciseId}:updateTaxWithholding", "/v1alpha1/issuers/{issuerId}/secondaryTransactions", "/v1alpha1/issuers/{issuerId}/secondaryTransactions/{secondaryTransactionId}:finalize", "/v1alpha1/openCapTables" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.carta.access_token || auth.own_app.access_token || auth.playground.access_token}}" } } } } ] }icon.svg
README.md
--- description: Read Carta cap tables, equity, fund data and holdings, and book fund accounting entries. --- # Carta Connect Carta so your agents can answer equity questions from the source. For companies, they can read cap tables by share class or stakeholder, stakeholders and their equity, option grants, RSUs, RSAs, certificates, convertible notes, exercises, transaction history, share classes, vesting templates and 409A valuations. For investment firms, they can read funds, investments and their cap tables, holdings, cash balances, performance metrics, partners and their contacts. For shareholders, they can read portfolios, holdings, current fair market values, transactions and fund documents shared with limited partners. With write access, agents can also book capital calls, management fees and carried interest allocations, draft option grants, record exercise payments and tax withholding, settle secondary transactions, start companies on Carta Launch and upload Open Cap Table files. A fund accounting entry repeated with the same reference is recorded once. When you sign in, Carta asks which companies, firms or portfolios to share, and your Carta role still limits what agents can see. Your credentials stay on Houston's server. [Connect Carta](SETUP.md).SETUP.md
# Connect Carta 1. Choose **Read** or **Write** for **Access**. 2. Select **Authorize connection** and sign in with your Carta account. 3. On Carta's consent screen, choose the companies, firms or portfolios to share, then allow access. Houston keeps the connection signed in. Carta ends a sign-in that goes unused for 14 days; if requests start failing with an authorization error, select **Set up again** and sign in. ## Advanced ### Use your own Carta app Turn on **Use your own Carta app** to connect through an app you register with Carta, either in Carta's playground (a shared test environment with sample data that resets daily) or in production. Playground apps are self-serve. Production apps need Carta's review and cannot be edited afterwards; adding permissions later means submitting a new app. 1. Register at the [Carta Developer Portal](https://developers.app.carta.com/user/registration) (or **Login** with an existing Carta account), then click **Create App**. 2. Set **Grant type** to authorization code and add Houston's displayed callback URL under **Callbacks**. 3. Under **Scopes**, select every scope below. Houston requests the first list for **Read** access and both lists for **Write** access. - Read: `read_user_info`, `read_issuer_info`, `read_issuer_capitalizationtablesummary`, `read_issuer_stakeholdercapitalizationtable`, `read_issuer_shareclasses`, `read_issuer_stakeholders`, `read_issuer_securities`, `read_issuer_valuations`, `read_issuer_securitiestemplates`, `read_issuer_interests`, `read_issuer_draftsecurities`, `read_corporation_info`, `read_compensation_benchmarks`, `read_opencaptables`, `read_investor_firms`, `read_investor_funds`, `read_investor_investments`, `read_investor_capitalizationtables`, `read_investor_stakeholdercapitalizationtable`, `read_investor_securities`, `read_investor_cashbalances`, `read_investor_fundperformance`, `read_investor_partners`, `read_portfolio_info`, `read_portfolio_securities`, `read_portfolio_issuervaluations`, `read_portfolio_transactions` and `read_portfolio_fundinvestmentdocuments`. - Write: `readwrite_issuer_securities`, `readwrite_issuer_draftsecurities`, `readwrite_issuer_secondarytransactions`, `readwrite_draftissuers`, `readwrite_opencaptables`, `readwrite_file_upload`, `readwrite_investor_capitalcalls`, `readwrite_investor_carriedinterest` and `readwrite_investor_managementfees`. 4. Click **Submit**, then **View app details**, and enter the app's `client_id` and `client_secret` in Houston. 5. Under **Connect using**, choose **Connect with your Carta app** for production or **Connect with your Carta playground app** for the playground, then select **Authorize connection** and sign in. In the playground, pick the persona to simulate: Company editor for companies, Investor for firms, Employee for shareholders and Lawyer for Carta Launch. To use a playground app in production, promote it with **Actions → Promote to production** in the Developer Portal and complete Carta's [production review](https://docs.carta.com/api-platform/guides/getting-started/migrate-to-production/). Promotion creates a new production app: enter its `client_id` and `client_secret` in Houston, then select **Set up again** and sign in with **Connect with your Carta app**. Carta's fund accounting endpoints (capital calls, management fees, carried interest) are in beta; ask your Carta representative to enable them for your app before choosing **Write** access. ### Troubleshooting - **Requested OAuth scopes not granted**: the app lacks a scope above, or Carta granted fewer than requested. Add the scopes (a production app needs a new review) and sign in again. - **ACCESS_TO_RESOURCE_RESTRICTED**: the company, firm or portfolio wasn't shared at sign-in. Select **Set up again** and share it. - **MISSING_INTERNAL_PERMISSION**: your Carta role doesn't allow that data; ask a company or firm admin in Carta.tests
authentication.luau
return { contract = function(m) m.authentication({ { auth = {}, config = {}, endpoint = { "GET", "https://api.carta.com/v1alpha1/user" }, expected = "Bearer synthetic-oauth-token", header = "Authorization", method = "carta", oauth = true, publisher = { client_id = "synthetic-public-client", client_secret = "synthetic-client-secret", }, scopes = true, }, { auth = {}, config = { client_id = "synthetic-public-client", client_secret = "synthetic-client-secret", own_app = true, }, endpoint = { "GET", "https://api.carta.com/v1alpha1/user" }, expected = "Bearer synthetic-oauth-token", header = "Authorization", method = "own_app", oauth = true, publisher = {}, scopes = true, }, { auth = {}, config = { client_id = "synthetic-public-client", client_secret = "synthetic-client-secret", own_app = true, }, endpoint = { "GET", "https://api.carta.com/v1alpha1/user" }, expected = "Bearer synthetic-oauth-token", header = "Authorization", method = "playground", oauth = true, publisher = {}, scopes = true, }, }) end, }endpoints.luau
return { contract = function(m) m.endpointRules() end, }errors.luau
return { scenario = {publisher = {client_id = "fixture-client", client_secret = "fixture-secret"}, access = {data = "write"}, config = {}, auth_method = "carta", auth_config = {}}, configure = function() calls = 0 status = 200 payload = "{}" responseHeaders = {} http = {request = function(req) calls += 1 return fixture.operation({statusCode = status, headers = responseHeaders, body = fixture.reader(payload)}) end} end, run = function(carta) local function upstream(code, body, headers, expected, call) status, payload, responseHeaders = code, body, headers local before = calls local ok, err = pcall(call or function() carta.createCapitalCall({firmId = "FIRM1", fundId = "FUND1", externalReferenceId = "ref-1", sourceSystem = "houston", dueDate = {value = "2026-11-01"}, amount = {value = "1.00"}, postAsDraft = true}) end) for _, text in expected do assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err)) end assert(calls == before + 1, "failed write was retried") return tostring(err) end upstream(403, '{"code":7,"message":"Access to resource denied","details":[{"@type":"type.googleapis.com/carta.proto.publicapi.errors.v1alpha1.ErrorInfo","reason":"INSUFFICIENT_SCOPE","metadata":{}}]}', {}, {"Carta HTTP 403", "(INSUFFICIENT_SCOPE)", "Access to resource denied", '"retryable":false'}) upstream(401, '{"code":16,"message":"Unauthenticated","details":[{"reason":"MISSING_OR_INVALID_ACCESS_TOKEN"}]}', {}, {"Carta HTTP 401 (MISSING_OR_INVALID_ACCESS_TOKEN): Unauthenticated"}) upstream(401, "Unauthorized", {}, {"Carta HTTP 401", '"upstream_status":401'}) local long = upstream(409, json.encode({code = 6, message = string.rep("x", 5000), details = {}}), {}, {"Carta HTTP 409: xxx", '"retryable":false'}) assert(not string.find(long, string.rep("x", 601), 1, true), "error message not bounded") upstream(404, '{"code":5,"message":"Resource not found","details":[]}', {}, {"Carta HTTP 404: Resource not found"}, function() carta.getIssuer({id = "999"}) end) upstream(429, '{"message":"API rate limit exceeded"}', {["ratelimit-reset"] = {"1"}}, {"Carta HTTP 429: API rate limit exceeded", "rate limit resets in 1s", '"retryable":true'}) upstream(503, '{"code":14,"message":"Service unavailable","details":[]}', {}, {"Carta HTTP 503", '"retryable":true'}) upstream(500, "<html>Internal error</html>", {}, {"Carta HTTP 500", '"retryable":true'}) upstream(200, "<html>Maintenance</html>", {}, {"invalid JSON object"}) upstream(200, "[]", {}, {"invalid JSON object"}, function() carta.listIssuers() end) upstream(200, "", {}, {"invalid JSON object"}, function() carta.listFirms() end) end, }manifest.luau
return { contract = function(m) do local readScopes = { "read_user_info", "read_issuer_info", "read_issuer_capitalizationtablesummary", "read_issuer_stakeholdercapitalizationtable", "read_issuer_shareclasses", "read_issuer_stakeholders", "read_issuer_securities", "read_issuer_valuations", "read_issuer_securitiestemplates", "read_issuer_interests", "read_issuer_draftsecurities", "read_corporation_info", "read_compensation_benchmarks", "read_opencaptables", "read_investor_firms", "read_investor_funds", "read_investor_investments", "read_investor_capitalizationtables", "read_investor_stakeholdercapitalizationtable", "read_investor_securities", "read_investor_cashbalances", "read_investor_fundperformance", "read_investor_partners", "read_portfolio_info", "read_portfolio_securities", "read_portfolio_issuervaluations", "read_portfolio_transactions", "read_portfolio_fundinvestmentdocuments", } local writeScopes = { "readwrite_issuer_securities", "readwrite_issuer_draftsecurities", "readwrite_issuer_secondarytransactions", "readwrite_draftissuers", "readwrite_opencaptables", "readwrite_file_upload", "readwrite_investor_capitalcalls", "readwrite_investor_carriedinterest", "readwrite_investor_managementfees", } for method, login in { carta = "https://login.app.carta.com", own_app = "https://login.app.carta.com", playground = "https://login.playground.carta.team", } do if (m.raw.auth[method].authorize_url ~= login .. "/o/authorize/") or (m.raw.auth[method].token_url ~= login .. "/o/access_token/") then m.fail( "%s endpoints %s %s", method, m.raw.auth[method].authorize_url, m.raw.auth[method].token_url ) end for _, access in { "read", "write" } do local config = {} local publisher = { client_id = "houston-client", client_secret = "houston-secret" } if method ~= "carta" then config["own_app"], config["client_id"], config["client_secret"], publisher = true, "fixture-client", "fixture-secret", nil end local r, err = m.resolve(publisher, config, nil, method, { data = access }) assert(not err, tostring(err)) local scopes = readScopes if access == "write" then scopes = m.concat(readScopes, writeScopes) end if not (m.equal(r.Scopes, scopes)) then m.fail("%s access=%s scopes %s", method, access, r.Scopes) end local token = "carta-" .. method r.Context.Auth[method].access_token = token for _, api in { "https://api.carta.com/v1alpha1", "https://api.playground.carta.team/v1alpha1" } do m.routes(r, "Bearer " .. token, true, { "GET " .. api .. "/user", "GET " .. api .. "/issuers?pageSize=50", "GET " .. api .. "/issuers/7/stakeholders/611/equitySummary", "GET " .. api .. "/investors/firms/F/funds/-/metrics", "GET " .. api .. "/portfolios/P/fundInvestmentDocuments/D:download", "POST " .. api .. "/issuers/7/securities:stockSplitChanges", }) m.routes(r, "Bearer " .. token, (access == "write"), { "GET " .. api .. "/investors/firms/F/funds/U/capitalCalls/C", "GET " .. api .. "/investors/firms/F/funds/U/managementFees/M", "GET " .. api .. "/issuers/7/secondaryTransactions/S", "GET " .. api .. "/draftIssuers/D", "POST " .. api .. "/investors/firms/F/funds/U/capitalCalls", "POST " .. api .. "/investors/firms/F/funds/U/capitalCalls/C:adjust", "POST " .. api .. "/issuers/7/optionExercises/E:updateTaxWithholding", "POST " .. api .. "/issuers/7/secondaryTransactions/S:finalize", "POST " .. api .. "/draftIssuers", "POST " .. api .. "/files:upload", }) m.routes(r, "Bearer " .. token, false, { "POST " .. api .. "/issuers", "DELETE " .. api .. "/issuers/7", "PATCH " .. api .. "/issuers/7/stakeholders/611", "GET " .. api .. "/issuers/7/unlisted", "POST " .. api .. "/issuers/7/securities:otherVerb", "GET " .. api .. "/issuers/%2e%2e/user", "GET https://api.carta.com/v1/issuers", }) end m.routes(r, "Bearer " .. token, false, { "POST https://login.app.carta.com/o/access_token/", "POST https://login.playground.carta.team/o/revoke_token/", "GET https://login.app.carta.com/o/userinfo/", "GET https://app.carta.com/v1alpha1/user", "GET https://mock-api.carta.com/v1alpha1/user", "GET https://api.carta.com.example.com/v1alpha1/user", "GET https://crm-public-api.app.carta.com/v1/me", }) end end end do local carta, err = m.resolve( { client_id = "houston-client", client_secret = "houston-secret" }, {}, nil, "carta", { data = "read" } ) assert(not err, tostring(err)) carta.Context.Auth["carta"].access_token = "carta-token" m.rejectOverrides(carta, { "GET https://api.carta.com/v1alpha1/issuers/7", "POST https://api.carta.com/v1alpha1/issuers/7/securities:stockSplitChanges", }) local cartaWrites, err = m.resolve( { client_id = "houston-client", client_secret = "houston-secret" }, {}, nil, "carta", { data = "write" } ) assert(not err, tostring(err)) cartaWrites.Context.Auth["carta"].access_token = "carta-token" m.rejectOverrides(cartaWrites, { "POST https://api.carta.com/v1alpha1/draftIssuers", "GET https://api.carta.com/v1alpha1/draftIssuers/D1", }) end end, }playground.luau
return { scenario = {publisher = {}, access = {data = "write"}, config = {own_app = true, client_id = "fixture-client", client_secret = "fixture-secret"}, auth_method = "playground", auth_config = {}}, configure = function() requests = {} http = {request = function(req) table.insert(requests, req) return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader('{"managementFee":{"id":"MF1"},"portfolios":[]}')}) end} end, run = function(carta) local API = "https://api.playground.carta.team/v1alpha1" local empty = carta.listPortfolios() assert(requests[1].method == "GET" and requests[1].url == API .. "/portfolios" and json.encode(empty.portfolios) == "[]") carta.getManagementFee({firmId = "FIRM1", fundId = "FUND1", managementFeeId = "MF1"}) assert(requests[2].url == API .. "/investors/firms/FIRM1/funds/FUND1/managementFees/MF1") carta.getStockSplitChanges({issuerId = "7", securities = json.decode("[]"), since = {value = "2026-01-01T00:00:00Z"}}) carta.createDraftIssuer({draftIssuer = {legalName = "Playco"}}) assert(requests[4].method == "POST" and requests[4].url == API .. "/draftIssuers") assert(#requests == 4) end, }read_only.luau
return { scenario = {publisher = {client_id = "fixture-client", client_secret = "fixture-secret"}, config = {}, auth_method = "carta", auth_config = {}}, configure = function() requests = {} payload = "{}" http = {request = function(req) table.insert(requests, req) return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)}) end} end, run = function(carta) local API = "https://api.carta.com/v1alpha1" local function last() return requests[#requests] end local function rejected(fn, expected) local before = #requests local ok, err = pcall(fn) assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err)) assert(#requests == before, "invalid input reached Carta") end local names = {} for name in carta do if name ~= "help" then table.insert(names, name) end end assert(#names == 63, "wrong read-only surface: " .. #names) for _, name in {"createCapitalCall", "adjustCapitalCall", "getCapitalCall", "createManagementFee", "getManagementFee", "createCarriedInterestAllocation", "createDraftOptionGrant", "updateExerciseMoneyMovement", "updateExerciseTaxWithholding", "initiateSecondarySettlement", "getSecondaryTransaction", "finalizeSecondarySettlement", "createDraftIssuer", "getDraftIssuer", "uploadOpenCapTable", "uploadFile"} do assert(carta[name] == nil, "read-only leaked " .. name) end assert(carta.getStockSplitChanges and carta.getOpenCapTable, "reads are missing") assert(#requests == 0, "initialization reached Carta") payload = '{"user":{"id":"2184ae6f-9415-465a-9f5f-80efbc81b266","email":"[email protected]"}}' assert(carta.getCurrentUser().user.email == "[email protected]") assert(last().method == "GET" and last().url == API .. "/user" and last().body == nil) assert(last().headers.Accept[1] == "application/json" and last().headers.Authorization == nil) payload = '{"issuers":[{"id":"7","legalName":"Acme","doingBusinessAsName":null}],"nextPageToken":"ODMxMw=="}' local opts = {pageSize = 50, pageToken = "abc=="} local page = carta.listIssuers(opts) assert(last().url == API .. "/issuers?pageSize=50&pageToken=abc%3D%3D", last().url) assert(opts.pageSize == 50 and opts.pageToken == "abc==", "caller options were modified") assert(page.issuers[1].id == "7" and page.issuers[1].doingBusinessAsName == json.decode("null") and page.nextPageToken == "ODMxMw==") payload = '{"stakeholders":[]}' local empty = carta.listStakeholders({issuerId = "7"}) assert(last().url == API .. "/issuers/7/stakeholders" and json.encode(empty.stakeholders) == "[]") carta.getStakeholder({issuerId = 7, id = "611"}) assert(last().url == API .. "/issuers/7/stakeholders/611") carta.getIssuerCapitalizationTable({issuerId = "7", asOfDate = "2026-10-19"}) assert(last().url == API .. "/issuers/7/capitalizationTable?asOfDate=2026-10-19") carta.listTransactions({issuerId = "7", type = "option", pageSize = 1000}) assert(last().url == API .. "/issuers/7/transactions?type=option&pageSize=1000") carta.getStakeholderEquitySummary({issuerId = "7", stakeholderId = "611", includeCanceled = true}) assert(last().url == API .. "/issuers/7/stakeholders/611/equitySummary?includeCanceled=true") local firm = "6f1c8a2e-0b9d-4c55-9a1e-3d2f7b8c9e10" carta.listPartnerContacts({firmId = firm, fundIds = {"f1", "f2"}, partnerIds = "p1"}) assert(last().url == API .. "/investors/firms/" .. firm .. "/partnerContacts?fundIds=f1,f2&partnerIds=p1", last().url) carta.listFundPerformanceMetrics({firmId = firm, fundId = "-", reportType = "BY_FUND", asOfDateTime = "2026-09-30T00:00:00Z"}) assert(last().url == API .. "/investors/firms/" .. firm .. "/funds/-/metrics?asOfDateTime=2026-09-30T00%3A00%3A00Z&reportType=BY_FUND", last().url) carta.getInvestmentCapitalizationTable({firmId = firm, fundId = "F1", companyId = "C1", capitalizationTableId = "C1"}) assert(last().url == API .. "/investors/firms/" .. firm .. "/funds/F1/investments/C1/capitalizationTables/C1") payload = '{"downloadUrl":"https://s3.amazonaws.com/carta.public/doc.pdf?X-Amz-Signature=x","downloadUrlExpirationTime":"2026-10-19T12:00:00Z"}' local doc = carta.getFundInvestmentDocumentUrl({portfolioId = "P1", documentId = "J8X32hD6yttzNJULdzeugV"}) assert(last().url == API .. "/portfolios/P1/fundInvestmentDocuments/J8X32hD6yttzNJULdzeugV:download") assert(string.find(doc.downloadUrl, "X-Amz-Signature", 1, true)) carta.listPortfolioRestrictedStockUnits({portfolioId = "P1", issuerId = "7", lastModifiedDatetimeAfter = "2026-01-01T00:00:00Z"}) assert(last().url == API .. "/portfolios/P1/issuers/7/restrictedStockUnits?lastModifiedDatetimeAfter=2026-01-01T00%3A00%3A00Z") payload = '{"affectedAssets":[],"asOf":{"value":"2026-10-19T00:00:00Z"},"splitOccurredSince":false}' local split = carta.getStockSplitChanges({issuerId = "7", securities = {{securityType = "certificate", securityId = "S1"}}, since = {value = "2026-01-01T00:00:00Z"}}) assert(last().method == "POST" and last().url == API .. "/issuers/7/securities:stockSplitChanges") assert(last().headers["Content-Type"][1] == "application/json") local body = json.decode(last().body) assert(body.since.value == "2026-01-01T00:00:00Z" and body.securities[1].securityId == "S1" and body.issuerId == nil, "path field leaked into the body") assert(split.splitOccurredSince == false and json.encode(split.affectedAssets) == "[]") payload = "" local empty, emptyErr = pcall(function() carta.getStockSplitChanges({issuerId = "7", securities = json.decode("[]"), since = {value = "2026-01-01T00:00:00Z"}}) end) assert(not empty and string.find(tostring(emptyErr), "invalid JSON object", 1, true), "an empty read is not a success") local count = #requests rejected(function() carta.getIssuer() end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = "../user"}) end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = "7/stakeholders"}) end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = "7?x=1"}) end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = ""}) end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = -1}) end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = 1.5}) end, "id must be a Carta ID") rejected(function() carta.getIssuer({id = string.rep("a", 65)}) end, "id must be a Carta ID") rejected(function() carta.listTransactions({issuerId = "7"}) end, "type is required") rejected(function() carta.getStockSplitChanges({issuerId = "7", since = {value = "2026-01-01T00:00:00Z"}}) end, "securities is required") rejected(function() carta.getCompensationBenchmarks({corporationId = "1", jobArea = "ENGINEERING", geoAdjustmentLocation = "US"}) end, "postMoneyValuationBucket is required") rejected(function() carta.listIssuers({page_size = 10}) end, "listIssuers has no option page_size") rejected(function() carta.listPartners({firmId = firm, fundIds = json.decode("[]")}) end, "fundIds must not be an empty array") rejected(function() carta.listPartners({firmId = firm, fundIds = {a = "f1"}}) end, "array, not an object") rejected(function() carta.listIssuers("all") end, "opts must be an object") assert(#requests == count) end, }writes.luau
return { scenario = {publisher = {}, access = {data = "write"}, config = {own_app = true, client_id = "fixture-client", client_secret = "fixture-secret"}, auth_method = "own_app", auth_config = {}}, configure = function() requests = {} uploaded = nil status = 200 payload = "{}" fs = fixture.files() http = {request = function(req) table.insert(requests, req) if req.body ~= nil and type(req.body) ~= "string" then uploaded = await(req.body:readAll()) await(req.body:close()) end return fixture.operation({statusCode = status, headers = {}, body = fixture.reader(payload)}) end} end, run = function(carta) local API = "https://api.carta.com/v1alpha1" local FUND = API .. "/investors/firms/FIRM1/funds/FUND1" local function last() return requests[#requests] end local function sent() return json.decode(last().body) end local function usd(value) return {currencyCode = {value = "USD"}, amount = {value = value}} end local count = 0 for name in carta do if name ~= "help" then count += 1 end end assert(count == 79, "wrong read-write surface: " .. count) payload = '{"capitalCall":{"id":"CC1","status":"CAPITAL_CALL_STATUS_DRAFT","webUrl":"https://app.carta.com/x"},"replayed":false}' local call = carta.createCapitalCall({firmId = "FIRM1", fundId = "FUND1", externalReferenceId = "ref-1", sourceSystem = "houston", dueDate = {value = "2026-11-01"}, amount = {value = "250000.00"}, postAsDraft = true, interestIds = json.decode("[]")}) assert(last().method == "POST" and last().url == FUND .. "/capitalCalls") assert(last().headers["Content-Type"][1] == "application/json" and last().headers.Authorization == nil) local body = sent() assert(body.externalReferenceId == "ref-1" and body.postAsDraft == true and body.amount.value == "250000.00" and body.dueDate.value == "2026-11-01") assert(json.encode(body.interestIds) == "[]" and body.firmId == nil and body.fundId == nil, "path fields leaked into the body") assert(call.capitalCall.id == "CC1" and call.replayed == false) carta.getCapitalCall({firmId = "FIRM1", fundId = "FUND1", capitalCallId = "CC1"}) assert(last().method == "GET" and last().url == FUND .. "/capitalCalls/CC1" and last().body == nil) local saved = payload payload = "" local blank, blankErr = pcall(function() carta.getCapitalCall({firmId = "FIRM1", fundId = "FUND1", capitalCallId = "CC1"}) end) assert(not blank and string.find(tostring(blankErr), "invalid JSON object", 1, true), "an empty read gated as a write is not a success") payload = saved carta.adjustCapitalCall({firmId = "FIRM1", fundId = "FUND1", capitalCallId = "CC1", externalReferenceId = "ref-2", sourceSystem = "houston", amount = {value = "200000.00"}}) assert(last().method == "POST" and last().url == FUND .. "/capitalCalls/CC1:adjust" and sent().amount.value == "200000.00") carta.createManagementFee({firmId = "FIRM1", fundId = "FUND1", externalReferenceId = "fee-1", sourceSystem = "houston", periodStart = {value = "2026-07-01"}, periodEnd = {value = "2026-09-30"}, effectiveDate = {value = "2026-09-30"}, amount = usd("100.00"), interestAmounts = {{interestId = "I1", amount = {value = "100.00"}}}}) body = sent() assert(last().url == FUND .. "/managementFees" and body.interestAmounts[1].interestId == "I1" and body.amount.currencyCode.value == "USD") carta.createCarriedInterestAllocation({firmId = "FIRM1", fundId = "FUND1", externalReferenceId = "carry-1", sourceSystem = "houston", effectiveDate = {value = "2026-09-30"}, deltas = {{interestId = "I1", amount = {value = "-5.00"}}, {interestId = "I2", amount = {value = "5.00"}}}}) assert(last().url == FUND .. "/carriedInterestAllocations" and sent().deltas[1].amount.value == "-5.00") carta.updateExerciseMoneyMovement({issuerId = "7", exerciseId = "EX1", moneyMovement = {completionDate = {value = "2026-10-19"}}}) assert(last().url == API .. "/issuers/7/optionExercises/EX1:updateMoneyMovement" and sent().moneyMovement.completionDate.value == "2026-10-19") carta.updateExerciseTaxWithholding({issuerId = "7", exerciseId = "EX1", taxWithholdings = json.decode("[]")}) assert(last().url == API .. "/issuers/7/optionExercises/EX1:updateTaxWithholding" and last().body == '{"taxWithholdings":[]}') carta.createDraftOptionGrant({issuerId = "7", draftOptionGrantSetId = "S1", draftOptionGrant = {quantity = {value = "1000"}}}) assert(last().url == API .. "/issuers/7/draftOptionGrantSets/S1/draftOptionGrants" and sent().draftOptionGrant.quantity.value == "1000") status = 202 payload = '{"secondaryTransactionId":"0b8e6f5a-1c2d-4e3f-8a9b-0c1d2e3f4a5b","transactionState":"PENDING_ISSUER_OPTION_COST_REVIEW"}' local trade = carta.initiateSecondarySettlement({issuerId = "7", externalReferenceId = "trade-1", rightOfFirstRefusalOutcome = "WAIVED", pricePerShare = usd("4.20"), buyerInformation = {entityName = "Buyer LLC", email = "[email protected]"}, securities = {{securityType = "option_grant", securityId = "S1", stockOptionType = "ISO", quantity = {value = "10"}}}}) assert(last().url == API .. "/issuers/7/secondaryTransactions" and trade.secondaryTransactionId ~= nil) assert(sent().securities[1].quantity.value == "10" and sent().pricePerShare.amount.value == "4.20") payload = "" local final = carta.finalizeSecondarySettlement({issuerId = "7", secondaryTransactionId = trade.secondaryTransactionId}) assert(last().url == API .. "/issuers/7/secondaryTransactions/" .. trade.secondaryTransactionId .. ":finalize" and last().body == "{}") assert(final.success == true, "an accepted write without a body reports success") status = 200 payload = '{"draftIssuer":{"id":"D1","primaryContact":{"registrationUrl":"https://app.carta.com/register?token=x"}}}' carta.createDraftIssuer({draftIssuer = {legalName = "Newco"}}) assert(last().url == API .. "/draftIssuers" and sent().draftIssuer.legalName == "Newco") carta.getDraftIssuer({id = "D1"}) assert(last().method == "GET" and last().url == API .. "/draftIssuers/D1") carta.uploadFile({file = {filePayload = "SGVsbG8=", uploadDetails = {name = "hello.txt"}}}) assert(last().url == API .. "/files:upload" and sent().file.uploadDetails.name == "hello.txt") local zip = fs.open("captable.zip", "w") zip:write("PK\3\4ocf") await(zip:close()) payload = '{"openCapTable":{"id":"OCF1","createTime":"2026-10-19T12:00:00Z","state":"PROCESSING"}}' local ocf = carta.uploadOpenCapTable({path = "captable.zip"}) assert(last().method == "POST" and last().url == API .. "/openCapTables" and last().headers["Content-Type"][1] == "application/zip") assert(uploaded == "PK\3\4ocf" and ocf.openCapTable.state == "PROCESSING", "the OCF archive is sent as the raw body") local before = #requests local function rejected(fn, expected) local ok, err = pcall(fn) assert(not ok and string.find(tostring(err), expected, 1, true), tostring(err)) end rejected(function() carta.createCapitalCall({firmId = "FIRM1", fundId = "FUND1", externalReferenceId = "ref-1", sourceSystem = "houston", dueDate = {value = "2026-11-01"}, amount = {value = "1.00"}}) end, "postAsDraft is required") rejected(function() carta.createManagementFee({firmId = "FIRM1", fundId = "FUND1", externalReferenceId = "fee-1", sourceSystem = "houston", periodStart = {value = "2026-07-01"}, periodEnd = {value = "2026-09-30"}, effectiveDate = {value = "2026-09-30"}, amount = json.decode("null"), interestAmounts = json.decode("[]")}) end, "amount is required") rejected(function() carta.uploadOpenCapTable({}) end, "path is required") rejected(function() carta.uploadOpenCapTable({path = 7}) end, "path must be a session file path") local missing, notFound = pcall(function() carta.uploadOpenCapTable({path = "missing.zip"}) end) assert(not missing and notFound.code == "not_found", "a missing archive never reaches Carta") rejected(function() carta.uploadOpenCapTable({path = "captable.zip", contentType = "application/zip"}) end, "uploadOpenCapTable has no option contentType") assert(#requests == before and #requests == 15) end, }