Figma Analytics API

Figma Analytics API provides endpoints for tracking component, style, and variable usage across team libraries, enabling design system adoption measurement.

Documentation

Specifications

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-get-library-analytics-usages-response-body-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-usages-by-component-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-usages-by-file-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-actions-by-component-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-actions-by-team-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-style-usages-by-asset-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-style-usages-by-file-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-variable-usages-by-asset-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-library-analytics-variable-usages-by-file-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/figma/refs/heads/main/json-schema/figma-analytics-error-response-payload-schema.json

Other Resources

OpenAPI Specification

figma-analytics-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Figma Analytics API
  version: 0.21.0
  description: >-
    This is the OpenAPI specification for the [Figma REST
    API](https://www.figma.com/developers/api) Analytics endpoints.

    Note: we are releasing the OpenAPI specification as a beta given the large
    surface area and complexity of the REST API.
  termsOfService: https://www.figma.com/developer-terms/
  contact:
    email: [email protected]
servers:
- url: https://api.figma.com
  description: Figma Production API Server
tags:
- name: Library Analytics
  description: Operations for retrieving library usage and action analytics data
paths:
  /v1/analytics/libraries/{file_key}/usages:
    get:
      tags:
      - Library Analytics
      summary: Figma Get Library Analytics Usage Data
      security:
      - PersonalAccessToken: []
      - OAuth2:
        - library_analytics:read
      description: >-
        Returns a list of library analytics usage data broken down by the
        requested dimension.
      operationId: getLibraryAnalyticsUsages
      x-microcks-operation:
        dispatcher: FALLBACK
        dispatcherRules: |
          {
            "dispatcher": "FALLBACK",
            "fallback": "GetLibraryAnalyticsUsagesSuccessExample"
          }
      parameters:
      - $ref: '#/components/parameters/FileKeyPathParam'
      - $ref: '#/components/parameters/CursorQueryParam'
      - $ref: '#/components/parameters/GroupByQueryParam'
      - $ref: '#/components/parameters/OrderQueryParam'
      responses:
        '200':
          $ref: '#/components/responses/GetLibraryAnalyticsUsagesResponse'
        '400':
          $ref: '#/components/responses/BadRequestErrorResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedErrorResponse'
        '403':
          $ref: '#/components/responses/ForbiddenErrorResponse'
        '429':
          $ref: '#/components/responses/TooManyRequestsErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerErrorResponse'
components:
  securitySchemes:
    PersonalAccessToken:
      type: http
      scheme: bearer
      bearerFormat: Figma Personal Access Token
      description: Personal Access Token for authentication
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://www.figma.com/oauth
          tokenUrl: https://api.figma.com/v1/oauth/token
          scopes:
            library_analytics:read: Read library analytics
  parameters:
    FileKeyPathParam:
      name: file_key
      in: path
      description: File key of the library to fetch analytics data for.
      required: true
      schema:
        type: string
      example: "abc123xyz789"
    CursorQueryParam:
      name: cursor
      description: >-
        Cursor indicating what page of data to fetch. Obtained from prior
        API call.
      in: query
      schema:
        type: string
      example: "eyJwYWdlIjoxfQ=="
    GroupByQueryParam:
      name: group_by
      description: >-
        A dimension to group returned analytics data by. Accepts "component"
        or "file".
      required: true
      in: query
      schema:
        type: string
        enum:
        - component
        - file
      example: "component"
    OrderQueryParam:
      name: order
      description: >-
        How to order response rows by number of instances. This param can be
        either "asc" or "desc" (default).
      in: query
      schema:
        type: string
        enum:
        - asc
        - desc
        default: desc
      example: "desc"
  responses:
    GetLibraryAnalyticsUsagesResponse:
      description: Response from the GET /v1/analytics/libraries/{file_key}/usages endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GetLibraryAnalyticsUsagesResponseBody'
          examples:
            GetLibraryAnalyticsUsagesSuccessExample:
              $ref: '#/components/examples/GetLibraryAnalyticsUsagesSuccessExample'
    BadRequestErrorResponse:
      description: >-
        Bad request. Parameters are invalid or malformed. Please check the input
        formats.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponsePayload'
          examples:
            BadRequestExample:
              $ref: '#/components/examples/BadRequestExample'
    UnauthorizedErrorResponse:
      description: Token is missing or incorrect.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponsePayload'
          examples:
            UnauthorizedExample:
              $ref: '#/components/examples/UnauthorizedExample'
    ForbiddenErrorResponse:
      description: >-
        The request was valid, but the server is refusing action. The user might
        not have the necessary permissions for a resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponsePayload'
          examples:
            ForbiddenExample:
              $ref: '#/components/examples/ForbiddenExample'
    TooManyRequestsErrorResponse:
      description: >-
        API requests may be throttled or rate limited. Please wait a while
        before attempting the request again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponsePayload'
          examples:
            TooManyRequestsExample:
              $ref: '#/components/examples/TooManyRequestsExample'
    InternalServerErrorResponse:
      description: An internal server error occurred.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponsePayload'
          examples:
            InternalServerErrorExample:
              $ref: '#/components/examples/InternalServerErrorExample'
  schemas:
    GetLibraryAnalyticsUsagesResponseBody:
      type: object
      properties:
        components:
          description: >-
            An array of analytics data when breaking down usage by component.
          type: array
          items:
            $ref: '#/components/schemas/LibraryAnalyticsUsagesByComponent'
          example: []
        files:
          description: An array of analytics data when breaking down usage by file.
          type: array
          items:
            $ref: '#/components/schemas/LibraryAnalyticsUsagesByFile'
          example: []
        nextPage:
          type: boolean
          description: Whether there is a next page of data that can be fetched.
          example: true
        cursor:
          type: string
          description: >-
            The cursor to use to fetch the next page of data. Not present
            if nextPage is false.
          example: example_value
      required:
      - nextPage
    LibraryAnalyticsUsagesByComponent:
      type: object
      description: Library analytics usage data broken down by component.
      properties:
        componentKey:
          type: string
          description: Unique, stable id of the component.
          example: example_value
        componentName:
          type: string
          description: Name of the component.
          example: example_value
        componentSetKey:
          type: string
          description: >-
            Unique, stable id of the component set that this component belongs to.
          example: example_value
        componentSetName:
          type: string
          description: Name of the component set that this component belongs to.
          example: example_value
        numInstances:
          type: number
          description: The number of instances of the component within the organization.
          example: 42.5
        numTeamsUsing:
          type: number
          description: The number of teams using the component within the organization.
          example: 42.5
        numFilesUsing:
          type: number
          description: The number of files using the component within the organization.
          example: 42.5
      required:
      - componentKey
      - componentName
      - numInstances
      - numTeamsUsing
      - numFilesUsing
    LibraryAnalyticsUsagesByFile:
      type: object
      description: Library analytics usage data broken down by file.
      properties:
        fileName:
          type: string
          description: The name of the file using the library.
          example: example_value
        teamName:
          type: string
          description: The name of the team the file belongs to.
          example: example_value
        workspaceName:
          type: string
          description: The name of the workspace that the file belongs to.
          example: example_value
        numInstances:
          type: number
          description: >-
            The number of component instances from the library used within the file.
          example: 42.5
      required:
      - fileName
      - teamName
      - numInstances
    LibraryAnalyticsActionsByComponent:
      type: object
      description: Library analytics actions data broken down by component.
      properties:
        week:
          type: string
          description: The date in ISO 8601 format. e.g. 2023-12-13
          example: example_value
        componentKey:
          type: string
          description: Unique, stable id of the component.
          example: example_value
        componentName:
          type: string
          description: Name of the component.
          example: example_value
        detachments:
          type: number
          description: The number of detach events for this period.
          example: 42.5
        insertions:
          type: number
          description: The number of insertion events for this period.
          example: 42.5
      required:
      - week
      - componentKey
      - componentName
      - detachments
      - insertions
    LibraryAnalyticsActionsByTeam:
      type: object
      description: Library analytics action data broken down by team.
      properties:
        week:
          type: string
          description: The date in ISO 8601 format. e.g. 2023-12-13
          example: example_value
        teamName:
          type: string
          description: The name of the team using the library.
          example: example_value
        workspaceName:
          type: string
          description: The name of the workspace that the team belongs to.
          example: example_value
        detachments:
          type: number
          description: The number of detach events for this period.
          example: 42.5
        insertions:
          type: number
          description: The number of insertion events for this period.
          example: 42.5
      required:
      - week
      - teamName
      - detachments
      - insertions
    LibraryAnalyticsStyleUsagesByAsset:
      type: object
      description: Library analytics style usage data broken down by asset.
      properties:
        styleKey:
          type: string
          description: Unique, stable id of the style.
          example: example_value
        styleName:
          type: string
          description: The name of the style.
          example: example_value
        styleType:
          type: string
          description: The type of the style.
          example: example_value
        usages:
          type: number
          description: The number of usages of the style within the organization.
          example: 42.5
        teamsUsing:
          type: number
          description: The number of teams using the style within the organization.
          example: 42.5
        filesUsing:
          type: number
          description: The number of files using the style within the organization.
          example: 42.5
      required:
      - styleKey
      - styleName
      - styleType
      - usages
      - teamsUsing
      - filesUsing
    LibraryAnalyticsStyleUsagesByFile:
      type: object
      description: Library analytics style usage data broken down by file.
      properties:
        fileName:
          type: string
          description: The name of the file using the library.
          example: example_value
        teamName:
          type: string
          description: The name of the team the file belongs to.
          example: example_value
        workspaceName:
          type: string
          description: The name of the workspace that the file belongs to.
          example: example_value
        usages:
          type: number
          description: >-
            The number of times styles from this library are used within the file.
          example: 42.5
      required:
      - fileName
      - teamName
      - usages
    LibraryAnalyticsVariableUsagesByAsset:
      type: object
      description: Library analytics variable usage data broken down by variable.
      properties:
        variableKey:
          type: string
          description: Unique, stable id of the variable.
          example: example_value
        variableName:
          type: string
          description: The name of the variable.
          example: example_value
        variableType:
          type: string
          description: The type of the variable.
          example: example_value
        collectionKey:
          type: string
          description: Unique, stable id of the collection the variable belongs to.
          example: example_value
        collectionName:
          type: string
          description: The name of the collection the variable belongs to.
          example: example_value
        usages:
          type: number
          description: The number of usages of the variable within the organization.
          example: 42.5
        teamsUsing:
          type: number
          description: The number of teams using the variable within the organization.
          example: 42.5
        filesUsing:
          type: number
          description: The number of files using the variable within the organization.
          example: 42.5
      required:
      - variableKey
      - variableName
      - variableType
      - collectionKey
      - collectionName
      - usages
      - teamsUsing
      - filesUsing
    LibraryAnalyticsVariableUsagesByFile:
      type: object
      description: Library analytics variable usage data broken down by file.
      properties:
        fileName:
          type: string
          description: The name of the file using the library.
          example: example_value
        teamName:
          type: string
          description: The name of the team the file belongs to.
          example: example_value
        workspaceName:
          type: string
          description: The name of the workspace that the file belongs to.
          example: example_value
        usages:
          type: number
          description: >-
            The number of times variables from this library are used within the file.
          example: 42.5
      required:
      - fileName
      - teamName
      - usages
    ErrorResponsePayload:
      type: object
      description: A response indicating an error occurred.
      properties:
        error:
          type: boolean
          description: For erroneous requests, this value is always `true`.
          enum:
          - true
          example: true
        status:
          type: number
          description: Status code
          example: 42.5
        message:
          type: string
          description: A string describing the error
          example: example_value
      required:
      - error
      - status
      - message
  examples:
    GetLibraryAnalyticsUsagesSuccessExample:
      summary: Successful library analytics usage response
      value:
        components:
        - componentKey: "comp_abc123"
          componentName: "Primary Button"
          componentSetKey: "compset_xyz789"
          componentSetName: "Buttons"
          numInstances: 1542
          numTeamsUsing: 8
          numFilesUsing: 45
        - componentKey: "comp_def456"
          componentName: "Secondary Button"
          componentSetKey: "compset_xyz789"
          componentSetName: "Buttons"
          numInstances: 876
          numTeamsUsing: 6
          numFilesUsing: 32
        files:
        - fileName: "Marketing Landing Page"
          teamName: "Marketing Design"
          workspaceName: "Company Workspace"
          numInstances: 89
        - fileName: "Product Dashboard"
          teamName: "Product Design"
          workspaceName: "Company Workspace"
          numInstances: 156
        nextPage: true
        cursor: "eyJwYWdlIjoyfQ=="
    BadRequestExample:
      summary: Bad request error
      value:
        error: true
        status: 400
        message: "Invalid parameter: group_by must be 'component' or 'file'"
    UnauthorizedExample:
      summary: Unauthorized error
      value:
        error: true
        status: 401
        message: "Token is missing or incorrect"
    ForbiddenExample:
      summary: Forbidden error
      value:
        error: true
        status: 403
        message: "You do not have permission to access analytics for this library"
    TooManyRequestsExample:
      summary: Rate limit error
      value:
        error: true
        status: 429
        message: "Rate limit exceeded. Please wait before making another request"
    InternalServerErrorExample:
      summary: Internal server error
      value:
        error: true
        status: 500
        message: "An internal server error occurred"