Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

OpenAPI specification and types for the Figma REST API

License

NotificationsYou must be signed in to change notification settings

figma/rest-api-spec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Changelog

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

Usage

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

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

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 withRequestBody (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{typeGetFileResponse}from'@figma/rest-api-spec'// Many popular HTTP clients let you annotate response typesconstresult=awaitaxios.get<GetFileResponse>(url);result.data// This has type GetFileResponse

[8]ページ先頭

©2009-2025 Movatter.jp