İçeriğe geç
ajan.io

Belgeler menüsü

Bu sayfada

Beceri Kazan

Çalışma alanınızdan kimliğe göre bir Beceri alın

Saklanan her dosya için meta veriler de dahil olmak üzere, çalışma alanınızdan kimliğe göre bir Beceri alır.

Temel URL

https://api.ajan.io/skills/v1/{skillId}

Özel dağıtımlar Tüm isteklerde api.ajan.com'yı /api/public ile değiştirin.

Gerekli Kapsamlar

Bu uç nokta SKILL_API kapsamını gerektirir.

Beceriye izleyici erişimi gerektirir.

Parametreler

ParametreTürGerekliAçıklama
skillIddizeEvetAlınacak Yeteneğin UUID'si.

Örnek

javascript
const axios = require("axios");

async function getSkill(skillId) {
  const response = await axios.get(
    `https://api.ajan.io/skills/v1/${skillId}`,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY"
      }
    }
  );

  console.log("Skill:", response.data.skill);
  console.log("Files:", response.data.files);
}

getSkill("550e8400-e29b-41d4-a716-446655440000");

Yanıt Formatı

Başarılı Yanıt (200 Tamam)

typescript
{
  skill: {
    id: string;
    name: string;
    slug: string;
    description: string;
    instructions: string;
    integrationIds: string[];
    createdAt: string;
    updatedAt: string;
  };
  files: Array<{
    path: string;
    sizeBytes: number;
    extension: string;
    hasScript: boolean;
    sha256: string;
  }>;
}

files dizisi saklanan dosyaları içeriksiz olarak listeler. Desteklenen bir metin dosyasını okumak için Get Skill File kullanın.

Hata İşleme

Durum KoduAçıklama
400Geçersiz Beceri Kimliği biçimi
401Geçersiz veya eksik API anahtarı
403SKILL_API kapsamı veya Beceriler ürün erişimi eksik
404Beceri bulunamadı veya erişilebilir değil
429Oran sınırı aşıldı
500Dahili sunucu hatası

ajan, API anahtarınızı korumak ve uygulamalarınızın güvende kalmasını sağlamak için tarayıcı kaynaklı istekleri kasıtlı olarak engeller. Daha fazla bilgi için lütfen API Key Best Practices hakkındaki kılavuzumuza bakın.

OpenAPI

openapi: 3.0.0
info:
  title: ajan API
  version: 3.0.0
servers:
  - url: https://api.ajan.io
    description: Production
security:
  - bearerAuth: []
paths:
  /skills/v1/{skillId}:
    get:
      tags:
        - Skills
      summary: Get a Skill
      description: >-
        Retrieves a Skill by ID from your workspace, including metadata for
        every stored file.
      operationId: getSkill
      parameters:
        - $ref: '#/components/parameters/SkillId'
      responses:
        '200':
          description: Skill returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSkillResponse'
        '400':
          description: Invalid Skill ID
        '401':
          description: Invalid or missing API key
        '403':
          description: Missing required scope or access
        '404':
          description: Skill not found
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
components:
  parameters:
    SkillId:
      name: skillId
      in: path
      required: true
      description: UUID of the Skill.
      schema:
        type: string
        format: uuid
  schemas:
    GetSkillResponse:
      type: object
      required:
        - skill
        - files
      properties:
        skill:
          $ref: '#/components/schemas/Skill'
        files:
          type: array
          description: >-
            Stored Skill files, ordered by path. Includes text and binary files.
            Does not include file contents.
          items:
            $ref: '#/components/schemas/SkillFile'
    Skill:
      type: object
      required:
        - id
        - name
        - slug
        - description
        - instructions
        - integrationIds
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the Skill.
        name:
          type: string
          maxLength: 64
          description: Skill name.
        slug:
          type: string
          maxLength: 100
          pattern: ^[a-z0-9-]+$
          description: Stable Skill slug.
        description:
          type: string
          maxLength: 1024
          description: Description used to explain when the Skill should apply.
        instructions:
          type: string
          maxLength: 50000
          description: Skill instructions.
        integrationIds:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            Integration IDs attached to the Skill. Each integration must be
            enabled in your workspace.
        createdAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp for Skill creation.
        updatedAt:
          type: string
          format: date-time
          description: ISO 8601 timestamp for the latest Skill update.
    SkillFile:
      type: object
      required:
        - path
        - sizeBytes
        - extension
        - hasScript
        - sha256
      properties:
        path:
          type: string
          description: Relative path inside the Skill.
        sizeBytes:
          type: integer
          description: File size in bytes.
        extension:
          type: string
          description: Lowercase file extension, including the leading dot.
        hasScript:
          type: boolean
          description: Whether the file is a script file (`.py`, `.sh`, `.js`, or `.ts`).
        sha256:
          type: string
          description: Lowercase SHA-256 hash of the original file bytes.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"