Skip to main content

Add repositories with Swimm's API

If you have a large number of repositories, use our Add Repo API to add repositories in bulk.

Navigate to your workspace settings to generate an API Key.

Add Repository as non-admin

Note: Please reach out to your Swimm representative to enable API Keys for your workspace.

Send a POST request

Use the following details:


TypeKeyValue
URL-https://app.swimm.io/api
Headerx-swimm-api-keyYour Swimm API Key
HeaderContent-Typeapplication/json
BodyworkspaceIdYour Swimm workspace ID
BodyrequestNameAddRepositoryToWorkspaceRequestV1
BodygitUrlURL of your Git repository to add

Example cURL Request

curl -X POST https://app.swimm.io/api \
-H "x-swimm-api-key: SWIMM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"requestName": "AddRepositoryToWorkspaceRequestV1",
"gitUrl": "URL_OF_YOUR_GIT_REPOSITORY",
"workspaceId": "SWIMM_WORKSPACE_ID"
}'

Post-Request Steps

After calling the API, follow these steps to ensure successful integration:

1. Validate the Response

Ensure the API response matches the expected format:

{
"repoId": "YOUR_SWIMM_REPO_ID",
"swimmJson": {
"repo_id": "YOUR_SWIMM_REPO_ID"
}
}

2. Commit the swimmJson Property

Save the swimmJson property content into your repository at the path .swm/swimm.json.

3. Merge and Push

Merge and push the .swm/swimm.json file to the branches you want to work with Swimm.