gitlab-apiGitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
Install via ClawdBot CLI:
clawdbot install d1gl3/gitlab-apiInteract with GitLab repositories via the REST API. Supports both GitLab.com and self-hosted instances.
Store your GitLab personal access token:
mkdir -p ~/.config/gitlab
echo "glpat-YOUR_TOKEN_HERE" > ~/.config/gitlab/api_token
Token scopes needed: api or read_api + write_repository
Get a token:
Default instance: https://gitlab.com
For self-hosted GitLab, create a config file:
echo "https://gitlab.example.com" > ~/.config/gitlab/instance_url
GITLAB_TOKEN=$(cat ~/.config/gitlab/api_token)
GITLAB_URL=$(cat ~/.config/gitlab/instance_url 2>/dev/null || echo "https://gitlab.com")
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects?owned=true&per_page=20"
Projects are identified by ID or URL-encoded path (namespace%2Fproject).
# By path
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/username%2Frepo"
# Extract ID from response: jq '.id'
PROJECT_ID="12345"
FILE_PATH="src/main.py"
BRANCH="main"
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}?ref=$BRANCH" \
| jq -r '.content' | base64 -d
PROJECT_ID="12345"
FILE_PATH="src/new_file.py"
BRANCH="main"
CONTENT=$(echo "print('hello')" | base64)
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
-d @- <<EOF
{
"branch": "$BRANCH",
"content": "$CONTENT",
"commit_message": "Add new file",
"encoding": "base64"
}
EOF
For updates, use -X PUT instead of -X POST.
curl -X DELETE -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
-d '{"branch": "main", "commit_message": "Delete file"}'
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/tree?path=src&ref=main"
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/archive.tar.gz" \
-o repo.tar.gz
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches"
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches" \
-d '{"branch": "feature-xyz", "ref": "main"}'
Use scripts/gitlab_api.sh for common operations:
# List projects
./scripts/gitlab_api.sh list-projects
# Read file
./scripts/gitlab_api.sh read-file <project-id> <file-path> [branch]
# Write file
./scripts/gitlab_api.sh write-file <project-id> <file-path> <content> <commit-msg> [branch]
# Delete file
./scripts/gitlab_api.sh delete-file <project-id> <file-path> <commit-msg> [branch]
# List directory
./scripts/gitlab_api.sh list-dir <project-id> <dir-path> [branch]
Full API docs: https://docs.gitlab.com/ee/api/api_resources.html
Key endpoints:
/api/v4/projects/api/v4/projects/:id/repository/files/api/v4/projects/:id/repository/tree/api/v4/projects/:id/repository/branchesGenerated Mar 1, 2026
A software development team uses the GitLab API to automate code deployments by reading files from a repository, creating new branches for features, and updating configuration files upon merge requests. This ensures consistent deployment processes across environments, reducing manual errors and speeding up release cycles. It integrates with CI/CD tools to trigger deployments based on repository changes.
A technical writing team leverages the GitLab API to manage documentation stored in GitLab repositories, allowing them to read, update, and delete markdown files directly through automated scripts. This facilitates version control for documentation, enables collaborative editing, and ensures that documentation stays synchronized with code changes. It's particularly useful for maintaining up-to-date API docs or user manuals.
A project management office uses the GitLab API to list projects and repository trees, aggregating data into a custom dashboard for monitoring development progress and resource allocation. This helps in tracking project statuses, identifying bottlenecks, and generating reports for stakeholders. It supports decision-making by providing real-time insights into multiple GitLab projects.
An IT operations team employs the GitLab API to download repository archives regularly, creating automated backups of critical codebases for disaster recovery. This ensures data integrity and compliance with retention policies by scheduling archive downloads and storing them in secure cloud storage. It reduces manual backup efforts and minimizes risk of data loss.
A development team uses the GitLab API to create and list branches, streamlining feature development workflows by automating branch creation for new tasks and managing branch lifecycles. This enhances collaboration among developers, reduces merge conflicts, and integrates with code review tools to maintain code quality. It's ideal for agile teams working on multiple features simultaneously.
A company builds a SaaS platform that integrates the GitLab API to offer enhanced repository management, analytics, and automation tools to other businesses. Revenue is generated through subscription tiers based on features like advanced reporting, custom workflows, and API usage limits. This model targets enterprises seeking to optimize their GitLab usage without in-house development.
A consulting firm provides services to help organizations implement and customize GitLab API integrations for specific needs, such as automating deployments or building internal tools. Revenue comes from project-based fees, hourly rates for development, and ongoing support contracts. This model appeals to companies lacking technical expertise or resources for API integration.
A startup develops open-source tools or scripts that leverage the GitLab API, offering basic features for free and charging for premium functionalities like advanced automation, team collaboration, or enterprise security. Revenue is generated through one-time purchases or annual licenses for the premium version. This model targets individual developers and small teams looking to enhance their GitLab workflows.
💬 Integration Tip
Start by setting up the personal access token with minimal scopes like 'read_api' and 'write_repository' to ensure security, and use the provided helper script to test basic operations before scaling to more complex integrations.
Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.
Connect to 100+ APIs (Google Workspace, Microsoft 365, GitHub, Notion, Slack, Airtable, HubSpot, etc.) with managed OAuth. Use this skill when users want to...
Build, debug, and deploy websites using HTML, CSS, JavaScript, and modern frameworks following production best practices.
YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Scaffold, test, document, and debug REST and GraphQL APIs. Use when the user needs to create API endpoints, write integration tests, generate OpenAPI specs, test with curl, mock APIs, or troubleshoot HTTP issues.
Search for jobs across LinkedIn, Indeed, Glassdoor, ZipRecruiter, Google Jobs, Bayt, Naukri, and BDJobs using the JobSpy MCP server.