{"id":20181387,"url":"https://github.com/ac000/mtd-cli","last_synced_at":"2026-04-22T16:35:27.257Z","repository":{"id":42442903,"uuid":"263445364","full_name":"ac000/mtd-cli","owner":"ac000","description":"Command line client for interfacing with the UK's HMRC Make Tax Digital API","archived":false,"fork":false,"pushed_at":"2025-10-31T23:36:06.000Z","size":244,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-01T01:16:50.297Z","etag":null,"topics":["c","cli","freebsd","hmrc","itsa","linux","mtd","tax","uk"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ac000.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"Contributing.rst","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":"DCO","cla":null}},"created_at":"2020-05-12T20:30:16.000Z","updated_at":"2025-10-31T23:36:05.000Z","dependencies_parsed_at":"2025-07-18T06:10:48.496Z","dependency_job_id":"ddfab7fa-512f-4531-b9ab-00ed0ff9644f","html_url":"https://github.com/ac000/mtd-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ac000/mtd-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ac000%2Fmtd-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ac000%2Fmtd-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ac000%2Fmtd-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ac000%2Fmtd-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ac000","download_url":"https://codeload.github.com/ac000/mtd-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ac000%2Fmtd-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32145868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T15:33:03.595Z","status":"ssl_error","status_checked_at":"2026-04-22T15:30:42.712Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cli","freebsd","hmrc","itsa","linux","mtd","tax","uk"],"created_at":"2024-11-14T02:35:23.623Z","updated_at":"2026-04-22T16:35:22.249Z","avatar_url":"https://github.com/ac000.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mtd-cli\n\n[![Builds](https://github.com/ac000/mtd-cli/actions/workflows/build_tests.yaml/badge.svg)](https://github.com/ac000/mtd-cli/actions/workflows/build_tests.yaml \"GitHub workflow builds\")\n[![FreeBSD Build Status](https://api.cirrus-ci.com/github/ac000/mtd-cli.svg)](https://cirrus-ci.com/github/ac000/mtd-cli \"Cirrus FreeBSD builds\")\n[![CodeQL](https://github.com/ac000/mtd-cli/workflows/CodeQL/badge.svg)](https://github.com/ac000/mtd-cli/actions?query=workflow:CodeQL \"Code quality workflow status\")\n\n## Overview\n\nmtd-cli is a command line client for Linux (other Unices should not be hard to\nsupport) to interface with the UK's HMRC\n[Make Tax Digital](https://developer.service.hmrc.gov.uk/api-documentation) API\n\nIt makes use of [libmtdac](https://github.com/ac000/libmtdac)\n\n\n## Build it\n\nmtd-cli is primarily developed under Linux but it also builds and runs under\nFreeBSD.\n\n### Linux\n\nOnce you have the above library built and installed, building this is as\nsimple as\n\n    $ make\n\n### FreeBSD\n\n    $ gmake\n\nor if you don't have GCC installed\n\n    gmake CC=clang\n\n\n## How to use\n\nIt's ready to use straight away, you can place the binary anywhere you like\nor just run it in place\n\n    $ src/mtd-cli\n\nIt has a fairly straightforward interface, essentially\n\n    mtd-cli init|init-creds|init-oauth|init-nino|bd|biss|bsas|ic|id|il|ob|sa|saac|vat|test-cu|test-fph [endpoint args ...]\n\nThe first argument specifies the API to interface with\n\n  * **init** is for doing an initial setup, creating the JSON config files.\n             This runs the equivalent of; *init-creds*, *init-oauth* \u0026\n             *init-nino*.\n\n  * **init-creds** is for regenerating the creds.json file.\n\n  * **init-oauth** is for doing a reauthorisation.\n\n  * **init-nino** is for storing the National Insurance Number in the nino.json file.\n\n  * **bd** is for interacting with the Business Details API.\n\n  * **sa** is for interacting with the Self-Assessment API.\n\n  * **saac** is for interacting with the Self-Assessment Accounts API.\n\n  * **ibeops** is for interacting with the Individuals Business End of Period Statement API.\n\n  * **ic** is for interacting with the Individual Calculations API.\n\n  * **id** is for interacting with the Individuals Disclosures API.\n\n  * **il** is for interacting with the Individual Loses API.\n\n  * **biss** is for interacting with the Business Income Source Summary API.\n\n  * **bsas** is for interacting with the Business Source Adjustable Summary API.\n\n  * **ob** is for interacting with the Obligations API.\n\n  * **vat** is for interacting with the VAT API.\n\n  * **test-cu** is for interacting with the Create Test User API.\n\n  * **test-fph** is for interacting with the Test Fraud Prevention Headers API.\n\n*init*, *oauth* \u0026 *config* don't take any arguments.\n\n**bd** supports the following commands\n\n    list get\n\nwith the following usage\n\n    $ mtd-cli bd list\n\n    $ mtd-cli bd get businessId\n\n*businessId* is what used to be called *selfEmploymentId*\n\n\n**sa** takes various arguments, the first of which is the endpoint of the API\nto connect to. These are\n\n    Self-Employment\n\n    se-create-employment se-list-periods se-create-period se-get-period\n    se-update-period se-get-annual-summary se-update-annual-summary\n\n    UK Property Business\n\n    pb-create-property pb-list-non-fhl-periods\n    pb-create-non-fhl-period pb-get-non-fhl-period\n    pb-update-non-fhl-period pb-get-non-fhl-annual-summary\n    pb-update-non-fhl-annual-summary pb-list-fhl-periods pb-create-fhl-period\n    pb-get-fhl-period pb-update-fhl-period pb-get-fhl-annual-summary\n    pb-update-fhl-annual-summary\n\n    Dividends Income\n\n    di-get-annual-summary di-update-annual-summary\n\n    Savings Accounts\n\n    sa-list-accounts sa-create-account sa-get-account sa-get-annual-summary\n    sa-update-annual-summary\n\n    Charitable Giving\n\n    cg-get-charitable-giving cg-update-charitable-giving\n\nThe following shows each of the above and what arguments (if any) they take.\n\n    $ mtd-cli sa se-create-employment \u003cfile\u003e\n\n    $ mtd-cli sa se-list-periods selfEmploymentId\n\n    $ mtd-cli sa se-create-period \u003cfile\u003e selfEmploymentId\n\n    $ mtd-cli sa se-get-period selfEmploymentId periodId\n\n    $ mtd-cli sa se-update-period \u003cfile\u003e selfEmploymentId periodId\n\n    $ mtd-cli sa se-get-annual-summary selfEmploymentId taxYear\n\n    $ mtd-cli sa se-update-annual-summary \u003cfile\u003e selfEmploymentId taxYear\n\n    $ mtd-cli sa pb-create-property \u003cfile\u003e\n\n    $ mtd-cli sa pb-list-non-fhl-periods\n\n    $ mtd-cli sa pb-create-non-fhl-period \u003cfile\u003e\n\n    $ mtd-cli sa pb-get-non-fhl-period periodId\n\n    $ mtd-cli sa pb-update-non-fhl-period \u003cfile\u003e periodId\n\n    $ mtd-cli sa pb-get-non-fhl-annual-summary taxYear\n\n    $ mtd-cli sa pb-update-non-fhl-annual-summary \u003cfile\u003e taxYear\n\n    $ mtd-cli sa pb-list-fhl-periods\n\n    $ mtd-cli sa pb-create-fhl-period \u003cfile\u003e\n\n    $ mtd-cli sa pb-get-fhl-period periodId\n\n    $ mtd-cli sa pb-update-fhl-period \u003cfile\u003e periodId\n\n    $ mtd-cli sa pb-get-fhl-annual-summary taxYear\n\n    $ mtd-cli sa pb-update-fhl-annual-summary \u003cfile\u003e taxYear\n\n    $ mtd-cli sa di-get-annual-summary taxYear\n\n    $ mtd-cli sa di-update-annual-summary \u003cfile\u003e taxYear\n\n    $ mtd-cli sa sa-list-accounts\n\n    $ mtd-cli sa sa-create-account \u003cfile\u003e\n\n    $ mtd-cli sa sa-get-account savingsAccountId\n\n    $ mtd-cli sa sa-get-annual-summary savingsAccountId taxYear\n\n    $ mtd-cli sa sa-update-annual-summary \u003cfile\u003e savingsAccountId taxYear\n\n    $ mtd-cli sa cg-get-charitable-giving taxYear\n\n    $ mtd-cli sa cg-update-charitable-giving taxYear\n\n*selfEmploymentId* is an 'id' as returned from '*mtd-cli sa se-list-employments*'.\n\n*periodId* is an 'id' as returned from '*mtd-cli sa \\*-list-periods ...*'.\n\n*\\\u003cfile\\\u003e* is a file containing JSON in the appropriate format for the endpoint\nbeing used.\n\n*get-end-of-period-statement* takes an optional query string.\n\nBoth the *from* \u0026 *to* parts are optional\n\n    $ mtd-cli sa get-end-of-period-statement XXXX1234567890 from=2020-01-01,to=2020-05-01\n\n*savingsAccountId* is an 'id' as returned from '*mtd-cli sa sa-list-accounts*'.\n\n*taxYear* is in the form *YYYY-YY*\n\n\n**saac** takes various arguments, the first of which is the endpoint of the API\nto connect to. These are\n\n    Payments and Liabilities\n\n    get-balance list-transactions get-transaction list-charges get-charge\n    list-payments get-payment\n\n    Coding Out Underpayments and Debts\n\n    co-get co-set co-delete\n\nThe following shows each of the above and what arguments (if any) they take.\n\n    $ mtd-cli saac get-balance\n\n    $ mtd-cli saac list-transactions from=YYYY-MM-DD,to=YYYY-MM-DD\n\n    $ mtd-cli saac get-transaction transactionId\n\n    $ mtd-cli saac list-charges from=YYYY-MM-DD,to=YYYY-MM-DD\n\n    $ mtd-cli saac get-charge transactionId\n\n    $ mtd-cli saac list-payments from=YYYY-MM-DD,to=YYYY-MM-DD\n\n    $ mtd-cli saac get-payment paymentId\n\n    $ mtd-cli saac co-get taxYear\n\n    $ mtd-cli saac co-set \u003cfile\u003e taxYear\n\n    $ mtd-cli saac co-delete taxYear\n\n*transactionId* is an 'id' as returned from\n'*mtd-cli saac list-transactions from to*'.\n\n*paymentId* is an 'id' as returned from '*mtd-cli saac list-payments from to*'.\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"taxCodeComponents\": {\n        \"payeUnderpayment\": [\n            {\n                \"amount\": 2000.50,\n                \"id\": 1234567890\n            }\n        ],\n        \"selfAssessmentUnderpayment\": [\n            {\n                \"amount\": 1123.45,\n                \"id\": 4657839807\n            }\n        ],\n        \"debt\": [\n            {\n                \"amount\": 100.25,\n                \"id\": 2134693857\n            }\n        ],\n        \"inYearAdjustment\": {\n            \"amount\": 123.45,\n            \"id\": 9873562901\n        }\n    }\n}\n```\n\n\n**ibeops** supports the following commands\n\n    submit-end-of-period-statement\n\nwith the following usage\n\n    $ mtd-cli ibeops submit-end-of-period-statement \u003cfile\u003e\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"typeOfBusiness\": \"self-employment\",\n    \"businessId\": \"XAIS12345678910\",\n    \"accountingPeriod\" : {\n        \"startDate\": \"2021-04-06\",\n        \"endDate\": \"2022-04-05\"\n    },\n    \"finalised\": true\n}\n```\n\n\n**ic** supports the following commands\n\n    TAX Calculations\n\n    list-calculations trigger-calculation get-calculation\n\n    Final Declaration\n\n    final-declaration\n\nwith the following usage\n\n    $ mtd-cli ic list-calculations [taxYear=YYYY-YY]\n\n    $ mtd-cli ic trigger-calculation [finalDeclaration={true,false}]\n\n    $ mtd-cli ic get-calculation taxYear calculationId\n\n    $ mtd-cli ic final-declaration taxYear calculationId\n\n*calculationId* is an *'id'* as returned by the\n'*mtd-cli ic list-calculations*' command.\n\n\n**id** supports the following commands\n\n    get set delete\n\n    Marriage Allowance\n\n    ma-create\n\nwith the following usage\n\n    $ mtd-cli id get taxYear\n\n    $ mtd-cli id set \u003cfile\u003e taxYear\n\n    $ mtd-cli id delete taxYear\n\n    $ mtd-cli id ma-create \u003cfile\u003e\n\n*taxYear* is a tax year in the form *YYYY-YY*\n\nmtd-cli id get: *\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"taxAvoidance\": [\n        {\n            \"srn\": \"14211123\",\n            \"taxYear\": \"2020-21\"\n        }\n    ],\n    \"class2Nics\": {\n        \"class2VoluntaryContributions\": true\n    }\n}\n```\n\nmtd-cli id ma-create: *\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"spouseOrCivilPartnerNino\": \"TC663795B\",\n    \"spouseOrCivilPartnerFirstName\": \"John\",\n    \"spouseOrCivilPartnerSurname\": \"Smith\",\n    \"spouseOrCivilPartnerDateOfBirth\": \"1987-10-18\"\n}\n```\n\n\n**il** supports the following commands\n\n    Brought Forward Loses\n\n    bf-list-loses bf-create-loss bf-get-loss bf-delete-loss bf-update-loss-amnt\n\n    Loss Claims\n\n    lc-list-loses lc-create-loss lc-get-loss lc-delete-loss lc-update-loss-type\n    lc-update-loss-order\n\nwith the following usage\n\n    $ mtd-cli il bf-list-loses [[businessId=][,[taxYearBroughtForwardFrom=YYYY-YY][,[typeOfLoss={self-employment,uk-property-fhl,uk-property-non-fhl}]]]]\n\n    $ mtd-cli il bf-create-loss \u003cfile\u003e\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"taxYearBroughtForwardFrom\": \"2020-21\",\n    \"businessId\": \"XBIS12345678910\",\n    \"typeOfLoss\": \"self-employment\",\n    \"lossAmount\": 5001.99\n}\n```\n\n    $ mtd-cli il bf-get-loss lossId\n\n    $ mtd-cli il bf-delete-loss lossId\n\n    $ mtd-cli il bf-update-loss-amnt \u003cfile\u003e lossId\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"lossAmount\": 12345.67\n}\n```\n\n    $ mtd-cli il lc-list-loses [[businessId=][,[taxYearClaimedFor=YYYY-YY][,[typeOfLoss={self-employment,uk-property-non-fhl,foreign-property}][,[typeOfClaim=carry-sideways]]]]]\n\n    $ mtd-cli il lc-create-loss \u003cfile\u003e\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"businessId\": \"XBIS12356589871\",\n    \"typeOfLoss\": \"self-employment\",\n    \"typeOfClaim\": \"carry-forward\",\n    \"taxYearClaimedFor\": \"2019-20\"\n}\n```\n\n    $ mtd-cli il lc-get-loss claimId\n\n    $ mtd-cli il lc-delete-loss claimId\n\n    $ mtd-cli il lc-update-loss-type \u003cfile\u003e claimId\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"typeOfClaim\": \"carry-forward\"\n}\n```\n\n    $ mtd-cli il lc-update-loss-order \u003cfile\u003e taxYearClaimedFor\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"typeOfClaim\": \"carry-sideways\",\n    \"listOfLossClaims\": [\n        {\n            \"claimId\": \"1234567890ABCDE\",\n            \"sequence\": 2\n        },\n        {\n            \"claimId\": \"1234567890ABDE0\",\n            \"sequence\": 3\n        },\n        {\n            \"claimId\": \"1234567890ABEF1\",\n            \"sequence\": 1\n        }\n    ]\n}\n```\n\n*lossId* is an 'id' as returned by the '*mtd-cli il bf-list-loses*' command\n\n*claimId* is an 'id' as returned by the '*mtd-cli il lc-list-loses*' command\n\n\n**biss** has the following endpoints\n\n    get-summary\n\nwith the following usage\n\n    $ mtd-cli biss get-summary typeOfBusiness taxYear businessId\n\n\n**bsas** has the following endpoints\n\n    list-summaries trigger-summary\n\n    Self-Employment\n\n    se-get-summary se-update-summary-adjustments\n\n    UK Property Business\n\n    pb-get-summary pb-update-summary-adjustments\n\n    Foreign Property Business\n\n    fp-get-summary fp-update-summary-adjustments\n\nwith the following usage\n\n    $ mtd-cli bsas list-summaries [[selfEmploymentId=][,[typeOfBusiness={self-employment,uk-property-non-fhl,uk-property-fhl,foreign-property-fhl-eea,foreign-property}][,[taxYear=YYYY-YY]]]]\n\n    $ mtd-cli bsas trigger-summary \u003cfile\u003e\n\n    $ mtd-cli bsas se-get-summary calculationId\n\n    $ mtd-cli bsas se-update-summary-adjustments \u003cfile\u003e calculationId\n\n    $ mtd-cli bsas pb-get-summary calculationId\n\n    $ mtd-cli bsas pb-update-summary-adjustments \u003cfile\u003e calculationId\n\n    $ mtd-cli bsas fp-get-summary calculationId\n\n    $ mtd-cli bsas fp-update-summary-adjustments \u003cfile\u003e calculationId\n\n*bsasId* is as returned by '*mtd-cli bsas list-summaries*'.\n\n\n**ob** has the following endpoints\n\n    list-inc-and-exp-obligations list-crystallisation-obligations\n    list-end-of-period-obligations\n\nwith the following usage\n\n    $ mtd-cli ob list-inc-and-exp-obligations [[typeOfBusiness={self-employment,uk-property,foreign-property}][,[businessId=]][,[fromDate=YYYY-MM-DD]][,[toDate=YYYY-MM-DD]][,[status={Open,Fulfilled}]]]\n\n    $ mtd-cli ob list-crystallisation-obligation [taxYear=YYYY-MM]\n\n    $ mtd-cli ob list-end-of-period-obligations [[typeOfBusiness={self-employment,uk-property,foreign-property}][,[businessId=]][,[fromDate=YYYY-MM-DD]][,[toDate=YYYY-MM-DD]][,[status={Open,Fulfilled}]]]\n\n*businessId* is what used to be called *selfEmploymentId*\n\n\n**vat** has the following commands\n\n    list-obligations submit-period get-period list-liabilities list-payments\n\nwith the following usage\n\n    $ mtd-cli vat list-obligations vrn [from=YYY-MM-DD][,[to=YYYY-MM-DD]][,[status=O|F]]\n\n    $ mtd-cli vat submit-period \u003cfile\u003e vrn\n\n    $ mtd-cli vat get-period vrn periodKek\n\n    $ mtd-cli vat list-liabilities vrn from=YYYY-MM-DD,to=YYYY-MM-DD\n\n    $ mtd-cli vat list-payments vrn from=YYYY-MM-DD,to=YYYY-MM-DD\n\n*vrn* is the VAT Registration Number\n\nIn the query string, *status=*; *O* is open and *F* is Fulfilled. Omit status\nto retrieve all obligations.\n\n*\\\u003cfile\\\u003e* is a JSON file that looks like\n\n```JSON\n{\n    \"periodKey\": \"A001\",\n    \"vatDueSales\": 105.50,\n    \"vatDueAcquisitions\": -100.45,\n    \"totalVatDue\": 5.05,\n    \"vatReclaimedCurrPeriod\": 105.15,\n    \"netVatDue\": 100.10,\n    \"totalValueSalesExVAT\": 300,\n    \"totalValuePurchasesExVAT\": 300,\n    \"totalValueGoodsSuppliedExVAT\": 3000,\n    \"totalAcquisitionsExVAT\": 3000,\n    \"finalised\": true\n}\n```\n\n\n**test-cu** has the following commands\n\n    create-individual create-organisation create-agent list-service\n\nwith the following usage\n\n    $ mtd-cli test-cu create-individual \u003cfile\u003e\n\n    $ mtd-cli test-cu create-organisation \u003cfile\u003e\n\n    $ mtd-cli test-cu create-agent \u003cfile\u003e\n\n    $ mtd-cli test-cu list-service\n\n*\\\u003cfile\\\u003e* is a JSON file containing a list of service names\n\n\n**test-fph** has the following commands\n\n    validate feedback\n\nwith the following usage\n\n    $ mtd-cli test-fph validate\n\n    $ mtd-cli test-fph feedback api [connectionMethod={BATCH_PROCESS_DIRECT,DESKTOP_APP_DIRECT,DESKTOP_APP_VIA_SERVER,MOBILE_APP_DIRECT,MOBILE_APP_VIA_SERVER,OTHER_DIRECT,OTHER_VIA_SERVER,WEB_APP_VIA_SERVER}]\n\n*api* is the Making Tax Digital API to retrieve the validation information for\nand can be one of the following\n\n```\n    business-details-mtd\n    business-income-source-summary-mtd\n    business-source-adjustable-summary-mtd\n    cis-deductions-mtd\n    individual-calculations-mtd\n    individual-losses-mtd\n    individuals-business-end-of-period-statement-mtd\n    individuals-charges-mtd\n    individuals-disclosures-mtd\n    individuals-expenses-mtd\n    individuals-income-received-mtd\n    individuals-reliefs-mtd\n    individuals-state-benefits-mtd\n    obligations-mtd\n    other-deductions-mtd\n    property-business-mtd\n    self-assessment-mtd\n    self-assessment-accounts-mtd\n    vat-mtd\n```\n\n\nWhen running you will get a JSON response in both cases of error and success.\nThe response(s) will be wrapped in an array to cater for multiple responses\nbeing returned in the case of re-directs occurring. E.g\n\n```\n$ ./mtd-cli sa list-periods XXXX1234567890\n```\n```JSON\n[\n    {\n        \"status_code\": 200,\n        \"status_str\": \"OK\",\n        \"url\": \"https://test-api.service.hmrc.gov.uk/self-assessment/ni/XX123456/self-employments/XXXX1234567890/periods\",\n        \"method\": \"GET\",\n        \"xid\": \"cdadffb4-3836-4062-a84c-c03d9f28ff00\",\n        \"date\": \"2022-01-03T20:55:46.021Z\",\n        \"result\": [\n            {\n                \"id\": \"2020-04-06_2020-07-04\",\n                \"from\": \"2020-04-06\",\n                \"to\": \"2020-07-04\"\n            },\n            {\n                \"id\": \"2020-07-05_2020-10-05\",\n                \"from\": \"2020-07-05\",\n                \"to\": \"2020-10-05\"\n            }\n        ]\n    }\n]\n```\n\nin the case of multiple responses\n\n```\n$ ./mtd-cli sa cr-intent-to-crystallise 2018-19\n```\n```JSON\n[\n    {\n        \"status_code\": 303,\n        \"status_str\": \"See Other\",\n        \"url\": \"https://test-api.service.hmrc.gov.uk/self-assessment/ni/XX1234567/2018-19/intent-to-crystallise\",\n        \"method\": \"POST\",\n        \"xid\": \"a1e8057e-fbbc-47a8-a8b4-78d9f015c253\",\n        \"date\": \"2022-01-03T20:55:46.021Z\",\n        \"result\": null\n    },\n    {\n        \"status_code\": 200,\n        \"status_str\": \"OK\",\n        \"url\": \"https://test-api.service.hmrc.gov.uk/self-assessment/ni/XX1234567/calculations/c2c82d00-c407-4f98-ab7d-c8319c522e6b\",\n        \"method\": \"GET\",\n        \"xid\": \"a1e8057e-fbbc-47a8-a8b4-78d9f015c253\",\n        \"date\": \"2022-01-03T20:55:51.345Z\",\n        \"result\": {\n            ...\n        }\n    }\n]\n````\n\nor in case of error\n\n\n```\n$ ./mtd-cli sa list-periods xxx\n```\n```JSON\n[\n    {\n        \"status_code\": 404,\n        \"status_str\": \"Not Found\",\n        \"url\": \"https://test-api.service.hmrc.gov.uk/self-assessment/ni/XX123456/self-employments/xxx/periods\",\n        \"method\": \"GET\",\n        \"xid\": \"dc1411d0-5ae4-48b8-84e0-4c5379b245b8\",\n        \"date\": \"2022-01-03T20:55:46.021Z\",\n        \"result\": null\n    }\n]\n```\n\n## Environment variables\n\nCurrently there are two environment variables that can bet set to control\nbehaviour\n\n#### **MTD_CLI_OPT_LOG_LEVEL**\n\nThis can be used to override the default log level (MTD\\_OPT\\_LOG\\_ERR).\n\nCurrently recognised values are; *debug* \u0026 *info*\n\n#### **MTD_CLI_OPT_NO_FPH_HDRS**\n\nThis can be used to disable the sending of 'Fraud Prevention Headers', set it\nto\n\n*true* or *1*\n\n#### **MTD_CLI_HDRS**\n\nThis can be used to set extra HTTP headers to be sent.\n\nCurrently only one header is supported which should be sufficient for setting\nthe *Gov-Test-Scenario* Test API header. e.g\n\n    MTD_CLI_HDRS=\"Gov-Test-Scenario: NO_SUBMISSIONS_EXIST\" mtd-cli sa cr-intent-to-crystallise 2018-19\n\n\n## License\n\nThis is licensed under the GNU General Public License (GPL) version 2\n\nSee *COPYING* in the repository root for details.\n\n\n## Contributing\n\nSee *CodingStyle.md* \u0026 *Contributing.md*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fac000%2Fmtd-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fac000%2Fmtd-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fac000%2Fmtd-cli/lists"}