# Query skill files

Lists static file metadata imported with skill packs. This interface only queries the skills in the current workspace and will not fall back to system skills.

```text
GET $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/skills/{skill_id}/files
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

First [query the skill list](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/agents/skills/list-skills.html.md) or [import the skill package](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/agents/skills/import-skill-package.html.md)] to obtain the skill ID.

Set the operation-specific values used in the request:

- `$SKILL_ID`: Skill ID.

## Request example

```bash
curl "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/skills/$SKILL_ID/files" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | The current workspace ID. |
| `skill_id` | string | Yes | Skill ID. |

## Successful response

Returns `200` on success.

```json
{
  "code": 0,
  "data": {
    "items": [
      {
        "file_path": "references/guide.md",
        "file_kind": "reference",
        "media_type": "text/markdown",
        "sha256": "abc123",
        "size_bytes": 1024
      }
    ],
    "total": 1
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.items` | array | Skill package static file metadata. |
| `data.items[].file_path` | string | The relative path of the file in the skill package. |
| `data.items[].file_kind` | string | File category. |
| `data.items[].media_type` | string | File media type. |
| `data.items[].sha256` | string | SHA-256 digest of the file contents. |
| `data.items[].size_bytes` | integer | File size (bytes). |
| `data.total` | integer | Number of files. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.


## Error response

```json
{
  "code": 3,
  "message": "<错误信息>",
  "details": {
    "reason": "SKILL_PACKAGE_FILE_NOT_FOUND"
  }
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`（`INVALID_ARGUMENT`）
  - The path parameter is invalid.
  - Check workspace and skill IDs.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Lack of valid identity credentials.
  - Check API Key.
* - `403`
  - `5`（`PERMISSION_DENIED`）
  - The current identity does not have permission to read the skill file.
  - Check workspace authorization.
* - `404`
  - `3`（`NOT_FOUND`）
  - The skill does not exist, or there is no readable file for the skill.
  - Check the skill ID; verify that the skill is imported from a skill pack and contains static files.
* - `503`
  - `15`（`UNAVAILABLE`）
  - Skill pack storage is unavailable.
  - Try again later.
```

## Follow-up operations

After saving the target file identification, you can [Download skill file](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/agents/skills/download-skill-file.html.md); when you need overall skill information, [Query skill details](https://omnifabric.cloudsigma.com/docs/reference/api/ai-studio/agents/skills/get-skill.html.md).
