Workflow

Connect GitHub and get an API collection from your code

Connect GitHub, choose a repository and one of its branches, and Swastik Codes reads the API routes in the code: methods, paths, path variables, query parameters, request body fields and which routes need a login. They become a collection you can send, test and run straight away, and publish as API documentation. When someone pushes to that branch, the collection updates itself. The names, descriptions, examples, tests and scripts you added in the app stay.

Get started freeSign inOpen the app

It works with public and private repositories, including those of organisations that allow the app, and needs no install: everything happens in the web app.

Set it up in four steps

  1. Connect GitHub. In the app, open New → API docs from a GitHub repository (or Account settings → GitHub) and click Connect GitHub. GitHub asks you to allow repository access. You can do this even if you signed up with email.
  2. Pick a repository. Your repositories are listed, most recently pushed first, with a search box. Type owner/repo to use any public repository that is not in the list.
  3. Pick a branch. Every branch is listed with the default branch first and marked. Type to filter. Repositories with hundreds of branches are searched on GitHub as you type, so any branch can be found. Optionally name the folder that holds the backend (such as backend or services/api) and choose whether to create a new collection or update one you already have.
  4. Scan and keep in sync. The first scan runs at once and opens the new collection.

What you get

For each route the collection gets:

  • a request in a folder named after its router, controller or tag, with a readable name;
  • {{baseUrl}} plus the path, with path variables such as :id ready to fill in;
  • the query parameters the code reads, and a JSON, form or multipart body with the fields it expects;
  • collection-level Bearer auth for routes that need a login.

The collection description links to the repository, the branch and the exact commit it was built from.

Frameworks it reads

LanguageFrameworks
PythonFastAPI, Flask, Django and Django REST Framework
JavaScript / TypeScriptExpress, Fastify, Koa, Hono, NestJS, Next.js API routes, Elysia
PHPLaravel, Symfony, Slim
Java / KotlinSpring, JAX-RS, Micronaut
Gonet/http, Gin, Echo, Fiber, chi, gorilla/mux
RustAxum, Actix Web, Rocket
RubyRails, Sinatra
C#ASP.NET Core (controllers and minimal APIs)

It is the same scanner as swc scan, so a collection from GitHub and one from your laptop match.

How it stays in sync

  • On every push. When you have admin rights on the repository, the sync adds a push webhook, so the collection updates seconds after a push to the branch.
  • Without admin rights it checks the branch for new commits every 10 minutes. With a webhook it still checks once an hour, in case a delivery was missed.
  • Your edits are kept. Requests are matched by method and path. A request whose route still exists gets the method, URL, parameters and body fields from the code, and keeps your tests, scripts, examples, auth and settings, and its name and description if you edited them.
  • Removed routes. With Remove requests for endpoints deleted from the code switched on, those requests are removed (earlier versions stay in the collection's history). Otherwise they are kept and reported.
  • Switch branches any time. Click Branch next to a synced repository to point it at another branch or folder. It rescans right away.
  • Sync now rescans the latest commit on demand, and each sync shows its last commit, when it last ran and what changed.

Your code and your token

  • The code is downloaded, read and deleted right after the scan. Nothing in it is run.
  • Your GitHub token is stored encrypted on our server and never sent to your browser. Disconnect in Account settings revokes it on GitHub too.
  • Signing in with GitHub never reads your repositories. Repository access is a separate step that you only take when you connect GitHub here.
  • Collections made from a repository live in your workspace like any other: share them with your team, run them in CI with the swc CLI, and publish them as API documentation that follows the code.

Just one scan, no sync

To build a collection once, open Import → GitHub repo. With GitHub connected you pick the repository and branch from lists, and you see every request before you import it. Without a connection, paste the URL of any public repository.

From your terminal

Prefer to scan the folder on your machine? Install the CLI and run swc init in your project:

Shell
curl -fsSL https://swastik.codes/install.sh | sh   # macOS and Linux
swc init

On Windows, run irm https://swastik.codes/install.ps1 | iex in PowerShell. See the CLI for swc sync, swc diff and running collections in CI.

Try it on your own API

Swastik Codes runs in the browser and is free to use. Create an account to send requests, sync your workspaces and invite your team.