> ## Documentation Index
> Fetch the complete documentation index at: https://nango-wari-add-support-for-sagemember.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a function's source code

> Returns the TypeScript source code of a function for a given integration. Requires an API key with the `environment:functions:read` scope.

<Info>
  Requires an API key with the `environment:functions:read` scope. [Learn more about API key scopes](/reference/backend/http-api/api-keys#scopes).
</Info>

Returns the TypeScript source code of a function for a given integration.


## OpenAPI

````yaml GET /integrations/{uniqueKey}/functions/{name}/code
openapi: 3.1.0
info:
  title: Nango API
  description: Nango API specs used to authorize & sync data with external APIs.
  version: 1.0.0
servers:
  - url: https://api.nango.dev
    description: Production server
  - url: http://localhost:3003
    description: Local server
security:
  - bearerAuth: []
externalDocs:
  url: https://nango.dev/docs/reference/backend/http-api/authentication
paths:
  /integrations/{uniqueKey}/functions/{name}/code:
    get:
      summary: Get a function's source code
      description: >-
        Returns the TypeScript source code of a function for a given
        integration. Requires an API key with the `environment:functions:read`
        scope.
      parameters:
        - name: uniqueKey
          in: path
          required: true
          schema:
            type: string
          description: The integration ID (unique_key) that you created in Nango.
        - name: name
          in: path
          required: true
          schema:
            type: string
          description: The name of the function.
        - name: type
          in: query
          required: false
          schema:
            type: string
            enum:
              - sync
              - action
              - on-event
          description: >-
            The function type. Required to disambiguate when multiple functions
            share the same name.
      responses:
        '200':
          description: Successfully returned the function source code
          content:
            application/json:
              schema:
                type: object
                required:
                  - type
                  - code
                properties:
                  type:
                    type: string
                    enum:
                      - sync
                      - action
                      - on-event
                    description: The function type.
                  code:
                    type: string
                    description: The TypeScript source code of the function.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            Multiple functions share the same name. Specify a `type` to
            disambiguate.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - ambiguous_function
                      message:
                        type: string
                      payload:
                        type: object
                        properties:
                          matches:
                            type: array
                            items:
                              type: object
                              required:
                                - type
                                - name
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - sync
                                    - action
                                    - on-event
                                name:
                                  type: string
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StdError'
  schemas:
    StdError:
      type: object
      additionalProperties: false
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - code
          properties:
            code:
              type: string
            message:
              type: string
            errors:
              type: array
              items:
                type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: The secret key from your Nango environment.

````