{"id":15552256,"url":"https://github.com/bahmutov/cy-api","last_synced_at":"2026-01-22T00:17:54.897Z","repository":{"id":35020261,"uuid":"195911525","full_name":"bahmutov/cy-api","owner":"bahmutov","description":"Cypress custom command \"cy.api\" for end-to-end API testing","archived":false,"fork":false,"pushed_at":"2024-09-28T04:12:27.000Z","size":945,"stargazers_count":208,"open_issues_count":18,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-19T06:16:25.025Z","etag":null,"topics":["cypress","cypress-io","cypress-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bahmutov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-07-09T01:42:26.000Z","updated_at":"2024-08-30T15:06:46.000Z","dependencies_parsed_at":"2024-01-20T09:29:44.879Z","dependency_job_id":"60f5ab38-53b6-46ec-8397-759b29417f58","html_url":"https://github.com/bahmutov/cy-api","commit_stats":{"total_commits":229,"total_committers":13,"mean_commits":"17.615384615384617","dds":0.5109170305676856,"last_synced_commit":"eae8c2836204f9b51852d74f5d14331b914d0a84"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcy-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcy-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcy-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fcy-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/cy-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234571854,"owners_count":18854384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cypress","cypress-io","cypress-plugin"],"created_at":"2024-10-02T14:13:57.344Z","updated_at":"2025-09-28T23:31:41.477Z","avatar_url":"https://github.com/bahmutov.png","language":"TypeScript","funding_links":[],"categories":["📦 Modules/Packages"],"sub_categories":["Testing"],"readme":"# @bahmutov/cy-api\n\n[![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-13.17.0-brightgreen)\n\n\u003e Cypress custom command \"cy.api\" for end-to-end API testing\n\nThis command makes HTTP requests to external servers, then renders the input and output where the web application usually is in the Cypress Test Runner. If there are server-side logs using [@bahmutov/all-logs][all-logs], this command fetches them and renders too. Here is typical output:\n\n![`cy.api` in action](images/cy-api.jpg)\n\n## Install\n\n```\nnpm install --save-dev @bahmutov/cy-api\n```\n\nor\n\n```\nyarn add -D @bahmutov/cy-api\n```\n\nAdd the following line to your Cypress support file\n\n```js\n// usually cypress/support/index.js\nimport '@bahmutov/cy-api'\n```\n\nThis will add a new command `cy.api` for making API requests.\n\n## Configuration\n\n| var env                      | default value | description                           |\n| ---------------------------- | ------------- | ------------------------------------- |\n| CYPRESS_API_MESSAGES         | true          | Show and make call to api server logs |\n| CYPRESS_API_SHOW_CREDENTIALS | false         | Show authentication password          |\n\nBy default `cy.api` print response in the browser. To have the same behaviour as `cy.request` and use `cy.visit` normally, you need to desactivate `apiDisplayRequest` :\n\n```js\nit('my test without displaying request', { apiDisplayRequest: false }, () =\u003e {\n  cy.api({\n    url: '/',\n  })\n})\n```\n\n## TypeScript\n\nIf your using TypeScript with Cypress, you can add type in your `tsconfig.json`\n\n```json\n{\n  \"compilerOptions\": {\n    \"types\": [\"cypress\", \"@bahmutov/cy-api\"]\n  }\n}\n```\n\n## Examples\n\n- [bahmutov/server-logs-example](https://github.com/bahmutov/server-logs-example)\n\n### Courses\n\n- 🎓 [Cypress Plugins](https://cypress.tips/courses/cypress-plugins/)\n  - [Lesson f2: Write an API test using the cy.api command](https://cypress.tips/courses/cypress-plugins/lessons/f2)\n\n## More info\n\n- Read [Black box API testing with server logs](https://glebbahmutov.com/blog/api-testing-with-server-logs/)\n- Read [Capture all the logs](https://glebbahmutov.com/blog/capture-all-the-logs/) and [@bahmutov/all-logs][all-logs] module.\n- Read [You Should Test More Using APIs](https://glebbahmutov.com/blog/test-using-apis/)\n- Read [Use Cypress For API Testing](https://glebbahmutov.com/blog/use-cypress-for-api-testing/)\n\n[all-logs]: https://github.com/bahmutov/all-logs\n\n## Development\n\n- install all dependencies using `npm install`\n- start watching and compiling the TS source using `npm run build:watch`\n- from another terminal launch the local server and open Cypress using `npm run dev`\n- open the desired Cypress spec file\n\n### Small print\n\nAuthor: Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt; \u0026copy; 2019\n\n- [@bahmutov](https://twitter.com/bahmutov)\n- [glebbahmutov.com](https://glebbahmutov.com)\n- [blog](https://glebbahmutov.com/blog)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/cy-api/issues) on Github\n\n## MIT License\n\nCopyright (c) 2019 Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt;\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg\n[renovate-app]: https://renovateapp.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcy-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fcy-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fcy-api/lists"}