# GitLab project file API

Get GitLab Project File data via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as output, path, and retrieve structured data including truncated and returned file text content to read repository manifests, verify file integrity, and inspect documentation snapshots, ready for production pipelines and AI agent automation.

Documentation: https://openany.si/gitlab/gitlab-project-file-api/babd0675-9ced-4b07-a1b9-07cc96a5b8e1/
API ID: babd0675-9ced-4b07-a1b9-07cc96a5b8e1
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/gitlab/v1/project/file
Page update time: 2026-12-03T02:38:48.949Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract.
Contract update time: 2026-12-03T02:38:22.672Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Usage and limits
## GitLab Project File API

Identify the file using path, file and optional ref, or supply a /-/blob/\<ref\>/\<file\> link in url. Omitting file defaults to the repository README on the default branch. Responses return content alongside blob\_id, commit\_id, sha256, size, binary and truncated flags.

## What You Can Build

- **Read repository manifests**: Retrieve package manifests, CI definitions or README files at a pinned tag or commit SHA.
- **Verify file integrity**: Compare sha256 and commit\_id against local mirrors or compliance baselines.
- **Inspect documentation snapshots**: Pull Markdown or configuration files from public repositories without cloning the full Git history.

## Returned Data

| Field | Meaning |
| --- | --- |
| `file` | Repository path of the returned file |
| `ref` | Branch, tag or commit used for retrieval |
| `commit_id` | Commit identifier associated with the file |
| `size` | Reported file size in bytes |
| `sha256` | SHA-256 checksum of the file |
| `binary` | Indicator flagging binary file content |
| `truncated` | Indicator flagging text truncated beyond 500,000 characters |
| `content` | Returned file text content |
| `raw_url` | Direct raw file URL on GitLab |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "GitLab project file API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string",
          "description": "Project path (namespace/project), link or numeric id."
        },
        "file": {
          "type": "string",
          "description": "File path in the repository (default: the README)."
        },
        "ref": {
          "type": "string",
          "description": "Branch, tag or commit (default: the default branch)."
        },
        "url": {
          "type": "string",
          "description": "Instead of path and file: a /-/blob/<ref>/<file> link."
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON exports are not exposed.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "Native CSV/NDJSON record selector; it has no effect on this JSON-only product."
        }
      }
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "binary": {
      "type": "boolean"
    },
    "blob_id": {
      "type": "string"
    },
    "cached": {
      "type": "boolean"
    },
    "commit_id": {
      "type": "string"
    },
    "content": {
      "type": "string"
    },
    "credits_used": {
      "type": "integer"
    },
    "executable": {
      "type": "boolean"
    },
    "file": {
      "type": "string"
    },
    "last_commit_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "project": {
      "type": "string"
    },
    "raw_url": {
      "type": "string"
    },
    "ref": {
      "type": "string"
    },
    "sha256": {
      "type": "string"
    },
    "size": {
      "type": "integer"
    },
    "truncated": {
      "type": "boolean"
    },
    "url": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Official documentation response · Supplier-tr
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/gitlab/v1/project/file?output=json&path=gitlab-org%2Fgitlab-runner' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "binary": false,
  "blob_id": "9b0ca792cf47a65754ac108767eef4b534ca23f6",
  "cached": false,
  "commit_id": "f3160876b6f1199b482d32ae5733f4183adf084c",
  "content": "# GitLab Runner\n\nThis is the repository of the official GitLab Runner written in Go.\nIt executes tests and sends the results to GitLab.\n\n[Gi…",
  "credits_used": 1,
  "executable": false,
  "file": "README.md",
  "last_commit_id": "9962b4022534a1272a3c610b9fee1c4833aa340c",
  "name": "README.md",
  "project": "gitlab-org/gitlab-runner",
  "raw_url": "https://gitlab.com/gitlab-org/gitlab-runner/-/raw/main/README.md",
  "ref": "main",
  "sha256": "83dd12da03d7e427f9e131b3019d9b0986daaa391862dab7b41ef9d02e02bb10",
  "size": 3895,
  "truncated": false,
  "url": "https://gitlab.com/gitlab-org/gitlab-runner/-/blob/main/README.md"
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Common questions
### What happens if I omit the file parameter?
When file is omitted, the API requests the repository README on the default branch.

### Can I pass a GitLab blob URL instead of path and file?
Yes. Supply a /-/blob/<ref>/<file> link in the url query parameter as an alternative to path, file and ref.

### Is there a size limit on returned text?
Yes. Text beyond 500,000 characters is truncated and flagged by truncated; binary files are also flagged via binary.

### How do I read a file from a specific tag or commit?
Set the ref query parameter to the target branch name, tag or commit SHA, or include it inside a blob url.

### Does this endpoint list directory contents?
No. It retrieves a single file. Use the GitLab Project Tree API to browse folders and discover file paths first.

### How do caching and output format work?
Output is JSON only. Pass fresh=1 to bypass the 24-hour cache and raw=0 to drop bulky raw blocks.

## Available implementations
- apish: https://openany.si/gitlab/gitlab-project-file-api/babd0675-9ced-4b07-a1b9-07cc96a5b8e1/

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
