New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@figma/rest-api-spec

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figma/rest-api-spec

Typings for the Figma REST API

  • 0.24.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39K
decreased by-2.66%
Maintainers
0
Weekly downloads
 
Created
Source

rest-api-spec

This repository contains the OpenAPI specification and Typescript types for the Figma REST API.

Changelog

Note: this specification is currently in beta. If you notice any inaccuracies with the specification, please file an issue in this repository.

Usage

The OpenAPI (v3.1.0) specification is located in the openapi/ directory. This specification can be used with a wide variety of tools to generate API documentation, client SDKs, and more.

The Typescript types are generated from the OpenAPI specification and are located in dist/.

We use a custom code generator to convert the OpenAPI spec to TypeScript. While there are a number of existing OpenAPI-to-Typescript code generators, we adopted a custom solution that produces output that we believe is more optimal for the Figma REST API. In particular:

  • All OpenAPI schemas, responses, and request parameters are exported as named types. This exposes named types inside complex node properties (e.g. Paint, VariableAlias, etc...).
  • Types directly associated with API endpoints are prefixed with the OpenAPI operation ID (e.g. getFile -> GetFilePathParams, GetFileQueryParams, GetFileResponse). For API endpoints expecting a request body, the types are suffixed with RequestBody (e.g. postComments -> PostCommentsRequestBody).

To use these types in your Typescript code, install the package:

npm install --save-dev @figma/rest-api-spec

Then import the types that you need:

import { type GetFileResponse } from '@figma/rest-api-spec'

// Many popular HTTP clients let you annotate response types
const result = await axios.get<GetFileResponse>(url);
result.data // This has type GetFileResponse

Keywords

FAQs

Package last updated on 13 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc