> ## Documentation Index
> Fetch the complete documentation index at: https://docs.insforge.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get function details

> Get a specific function including its code



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/functions.yaml get /api/functions/{slug}
openapi: 3.0.3
info:
  title: Insforge Functions API
  version: 1.0.0
  description: Serverless functions running in Deno runtime
servers: []
security: []
paths:
  /api/functions/{slug}:
    get:
      tags:
        - Admin
      summary: Get function details
      description: Get a specific function including its code
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
            pattern: ^[a-zA-Z0-9_-]+$
          description: Function slug identifier
          example: hello-world
      responses:
        '200':
          description: Function details with code
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionDetails'
              example:
                id: 123e4567-e89b-12d3-a456-426614174000
                slug: hello-world
                name: Hello World Function
                description: Returns a greeting message
                code: |
                  export default async function(request) {
                    const { name = 'World' } = await request.json();
                    return new Response(
                      JSON.stringify({ message: `Hello, ${name}!` }),
                      { headers: { 'Content-Type': 'application/json' } }
                    );
                  }
                status: active
                created_at: '2024-01-21T10:30:00Z'
                updated_at: '2024-01-21T10:35:00Z'
                deployed_at: '2024-01-21T10:35:00Z'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden - Admin only
        '404':
          description: Function not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Function not found
        '500':
          description: Failed to get function
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    FunctionDetails:
      allOf:
        - $ref: '#/components/schemas/FunctionMetadata'
        - type: object
          properties:
            code:
              type: string
              description: The function's JavaScript/TypeScript code
          required:
            - code
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        details:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
            - type: object
          description: Additional error details
        message:
          type: string
          description: Detailed error message
        pattern:
          type: string
          description: >-
            Pattern that caused validation failure (for dangerous code
            detection)
    FunctionMetadata:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the function
        slug:
          type: string
          description: URL-friendly identifier
          example: hello-world
        name:
          type: string
          description: Display name for the function
          example: Hello World Function
        description:
          type: string
          nullable: true
          description: Description of what the function does
        status:
          type: string
          enum:
            - draft
            - active
            - error
          description: Current status of the function
        created_at:
          type: string
          format: date-time
          description: When the function was created
        updated_at:
          type: string
          format: date-time
          description: When the function was last updated
        deployed_at:
          type: string
          format: date-time
          nullable: true
          description: When the function was last deployed (null if never deployed)
      required:
        - id
        - slug
        - name
        - status
        - created_at
        - updated_at
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````