Zeplin Spacing API

The Spacing API from Zeplin — 6 operation(s) for spacing.

OpenAPI Specification

zeplin-spacing-api-openapi.yml Raw ↑
openapi: 3.0.2
info:
  title: Zeplin Authorization Spacing API
  description: Access your resources in Zeplin
  version: 1.38.0
  contact:
    name: Zeplin
    url: https://zeplin.io
    email: support@zeplin.io
servers:
- url: https://api.zeplin.dev
security:
- PersonalAccessToken: []
- OAuth2: []
tags:
- name: Spacing
paths:
  /v1/projects/{project_id}/spacing_tokens:
    get:
      tags:
      - Spacing
      summary: Get spacing tokens of the project
      description: List all spacing tokens of the project
      operationId: GetProjectSpacingTokens
      parameters:
      - $ref: '#/components/parameters/project_id'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/include_linked_styleguides'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SpacingToken'
              examples:
                response:
                  $ref: '#/components/examples/spacingToken'
        '404':
          $ref: '#/components/responses/projectNotFound'
        '422':
          $ref: '#/components/responses/projectArchived'
  /v1/projects/{project_id}/spacing_tokens/{spacing_token_id}:
    patch:
      tags:
      - Spacing
      summary: Update project spacing token
      description: Update a spacing token in the project's local styleguide
      operationId: UpdateProjectSpacingToken
      parameters:
      - $ref: '#/components/parameters/project_id'
      - $ref: '#/components/parameters/spacing_token_id'
      security:
      - OAuth2: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpacingTokenUpdateBody'
      responses:
        '204':
          $ref: '#/components/responses/noContent'
        '403':
          $ref: '#/components/responses/cannotUpdateAProjectSpacingToken'
        '404':
          $ref: '#/components/responses/projectOrSpacingTokenNotFound'
        '422':
          $ref: '#/components/responses/notAProjectMemberOrArchived'
  /v1/projects/{project_id}/spacing_sections:
    get:
      tags:
      - Spacing
      summary: Get spacing sections of the project
      description: List all spacing sections of the project
      operationId: GetProjectSpacingSections
      parameters:
      - $ref: '#/components/parameters/project_id'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/offset'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SpacingSection'
              examples:
                response:
                  $ref: '#/components/examples/spacingSection'
        '404':
          $ref: '#/components/responses/projectNotFound'
        '422':
          $ref: '#/components/responses/projectArchived'
  /v1/styleguides/{styleguide_id}/spacing_tokens:
    get:
      tags:
      - Spacing
      summary: Get spacing tokens of the styleguide
      description: 'List all spacing tokens of the styleguide that user has access.


        See [Styleguide docs](#getstyleguide) for more details about how `linked_project` and `linked_styleguide` parameters can be used to retrieve resources from styleguides that user is eligible to access.

        '
      operationId: GetStyleguideSpacingTokens
      parameters:
      - $ref: '#/components/parameters/styleguide_id'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/linked_project'
      - $ref: '#/components/parameters/linked_styleguide'
      - $ref: '#/components/parameters/include_linked_styleguides'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SpacingToken'
              examples:
                response:
                  $ref: '#/components/examples/spacingToken'
        '404':
          $ref: '#/components/responses/styleguideNotFound'
        '422':
          $ref: '#/components/responses/styleguideArchived'
  /v1/styleguides/{styleguide_id}/spacing_tokens/{spacing_token_id}:
    patch:
      tags:
      - Spacing
      summary: Update styleguide spacing token
      description: Update a spacing token in the styleguide
      operationId: UpdateStyleguideSpacingToken
      parameters:
      - $ref: '#/components/parameters/styleguide_id'
      - $ref: '#/components/parameters/spacing_token_id'
      security:
      - OAuth2: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpacingTokenUpdateBody'
      responses:
        '204':
          $ref: '#/components/responses/noContent'
        '403':
          $ref: '#/components/responses/cannotUpdateAStyleguideSpacingToken'
        '404':
          $ref: '#/components/responses/styleguideOrSpacingTokenNotFound'
        '422':
          $ref: '#/components/responses/notAProjectMemberOrArchived'
  /v1/styleguides/{styleguide_id}/spacing_sections:
    get:
      tags:
      - Spacing
      summary: Get spacing sections of the styleguide
      description: 'List all spacing sections of the styleguide that user has access.


        See [Styleguide docs](#getstyleguide) for more details about how `linked_project` and `linked_styleguide` parameters can be used to retrieve resources from styleguides that user is eligible to access.

        '
      operationId: GetStyleguideSpacingSections
      parameters:
      - $ref: '#/components/parameters/styleguide_id'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/linked_project'
      - $ref: '#/components/parameters/linked_styleguide'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SpacingSection'
              examples:
                response:
                  $ref: '#/components/examples/spacingSection'
        '404':
          $ref: '#/components/responses/styleguideNotFound'
        '422':
          $ref: '#/components/responses/styleguideArchived'
components:
  examples:
    resourceSourceForStyleguide:
      summary: Source for Styleguide
      value:
        styleguide:
          $ref: '#/components/examples/resourceStyleguideSource/value'
    spacingSection:
      summary: Spacing Section
      value:
        id: 5dbad85a76ea51c1f35b6f69
        name: Spacing
        base_token:
          id: 5db81e6e6a4462065f04d932
    resourceStyleguideSource:
      summary: Source Styleguide
      value:
        id: 5db981be9df2b3e1bfa19ef2
        name: Discovery 1
        platform: web
        parent:
          id: 5db981be9df2b3e1bfa19ef2
    resourceSourceForProject:
      summary: Source for Project
      value:
        project:
          $ref: '#/components/examples/resourceProjectSource/value'
    resourceProjectSource:
      summary: Source Project
      value:
        id: 5db81e73e1e36ee19f138c1a
        name: HAL 9000
        platform: web
        linked_styleguide:
          id: 5db981be9df2b3e1bfa19ef2
    spacingToken:
      summary: Spacing Token
      value:
        id: 5dbad85a76ea51c1f35b6f69
        name: $spacingxs
        value: 16
        color:
          $ref: '#/components/examples/spacingTokenColor/value'
        section:
          id: 5db81e6e6a4462065f04d932
        source:
          $ref: '#/components/examples/resourceSourceForProject/value'
    error:
      summary: Error
      value:
        message: Project is not found
    spacingTokenColor:
      summary: Spacing Token Color
      value:
        r: 143
        g: 152
        b: 5
        a: 1
    entityReference:
      summary: Object Reference
      value:
        id: 5dbad85a76ea51c1f35b6f69
  responses:
    styleguideArchived:
      description: Styleguide archived response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Styleguide archived response:
              value:
                message: Styleguide is archived
    cannotUpdateAStyleguideSpacingToken:
      description: User cannot update a styleguide spacing token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            User cannot update a styleguide spacing token:
              value:
                message: User with role alien in a styleguide cannot update a spacing token
    notAProjectMemberOrArchived:
      description: Not a project member or project archived
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Not a member:
              value:
                message: User is not a member of the project
            Project is archived:
              value:
                message: Project is archived
    projectOrSpacingTokenNotFound:
      description: Project or spacing token not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Project not found:
              value:
                message: Project not found
            Spacing token not found:
              value:
                message: Spacing token not found
    projectNotFound:
      description: Project not found response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Project not found response:
              value:
                message: Project not found
    styleguideNotFound:
      description: Styleguide not found response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Styleguide not found response:
              value:
                message: Styleguide not found
    styleguideOrSpacingTokenNotFound:
      description: Styleguide or spacing token not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Styleguide not found:
              value:
                message: Styleguide not found
            Spacing token not found:
              value:
                message: Spacing token not found
    noContent:
      description: Successful response
    projectArchived:
      description: Project archived response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Project archived response:
              value:
                message: Project is archived
    cannotUpdateAProjectSpacingToken:
      description: User cannot update a project spacing token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            User cannot update a project spacing token:
              value:
                message: User with role alien in a project cannot update a spacing token
  schemas:
    SpacingSection:
      title: Spacing Section
      type: object
      required:
      - id
      - name
      - base_token
      properties:
        id:
          type: string
          description: The unique id of the section
        name:
          type: string
          description: The name of the section
        description:
          type: string
          description: The description of the section
        base_token:
          $ref: '#/components/schemas/EntityReference'
          description: Reference of the base token of the section
      example:
        $ref: '#/components/examples/spacingSection'
    ResourceProjectSource:
      title: Source Project
      type: object
      description: The source project of the resource
      required:
      - id
      - name
      - platform
      properties:
        id:
          type: string
          description: The unique id of the source project
        name:
          type: string
          description: The name of the source project
        platform:
          type: string
          enum:
          - web
          - ios
          - android
          - macos
          description: The target platform of the source project
        linked_styleguide:
          $ref: '#/components/schemas/EntityReference'
          description: Reference of the styleguide which the source project is linked to
      example:
        $ref: '#/components/examples/resourceProjectSource'
    SpacingTokenUpdateBody:
      title: Spacing Token Update Body
      type: object
      properties:
        name:
          type: string
          description: The name of the token
        value:
          type: number
          description: The value of the token
    EntityReference:
      title: Object Reference
      type: object
      required:
      - id
      properties:
        id:
          type: string
          description: Id of the entity
      example:
        $ref: '#/components/examples/entityReference'
    ErrorResponse:
      title: Error Response
      type: object
      required:
      - message
      properties:
        message:
          type: string
          description: A user readable descriptive message for the error
        detail:
          type: string
          description: A detailed message describing the error
        code:
          type: string
          description: The unique code for the error
      example:
        $ref: '#/components/examples/error'
    ResourceSource:
      title: Resource Source
      type: object
      description: Source details for resource. It has to be either `project` or `styleguide`.
      properties:
        project:
          $ref: '#/components/schemas/ResourceProjectSource'
        styleguide:
          $ref: '#/components/schemas/ResourceStyleguideSource'
      example:
        $ref: '#/components/examples/resourceSourceForProject'
      x-examples:
        Project:
          $ref: '#/components/examples/resourceSourceForProject'
        Styleguide:
          $ref: '#/components/examples/resourceSourceForStyleguide'
    SpacingTokenColor:
      title: Spacing Token Color
      type: object
      required:
      - r
      - g
      - b
      - a
      properties:
        r:
          type: integer
          description: red component of the color
        g:
          type: integer
          description: green component of the color
        b:
          type: integer
          description: blue component of the color
        a:
          type: number
          description: alpha component of the color
      example:
        $ref: '#/components/examples/spacingTokenColor'
    SpacingToken:
      title: Spacing Token
      type: object
      required:
      - id
      - name
      - value
      - color
      - section
      properties:
        id:
          type: string
          description: The unique id of the token
        name:
          type: string
          description: The name of the token
        value:
          type: number
          description: The value of the token
        color:
          $ref: '#/components/schemas/SpacingTokenColor'
        section:
          $ref: '#/components/schemas/EntityReference'
          description: Reference of the section that contains the token
        source:
          $ref: '#/components/schemas/ResourceSource'
          description: Source of the color–either `project` or `styleguide`.
      example:
        $ref: '#/components/examples/spacingToken'
    ResourceStyleguideSource:
      title: Source Styleguide
      type: object
      description: The source styleguide of the resource
      required:
      - id
      - name
      - platform
      properties:
        id:
          type: string
          description: The unique id of the source styleguide
        name:
          type: string
          description: The name of the source styleguide
        platform:
          type: string
          enum:
          - base
          - web
          - ios
          - android
          - macos
          description: The target platform of the source styleguide
        parent:
          $ref: '#/components/schemas/EntityReference'
          description: Reference of the parent styleguide of the source styleguide
      example:
        $ref: '#/components/examples/resourceStyleguideSource'
  parameters:
    linked_styleguide:
      name: linked_styleguide
      in: query
      description: Reference styleguide id
      required: false
      schema:
        type: string
        pattern: /^[0-9a-f]{24}$/i
    limit:
      name: limit
      in: query
      description: Pagination limit
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 30
    offset:
      name: offset
      in: query
      description: Pagination offset
      required: false
      schema:
        type: integer
        minimum: 0
        default: 0
    linked_project:
      name: linked_project
      in: query
      description: Reference project id
      required: false
      schema:
        type: string
        pattern: /^[0-9a-f]{24}$/i
    project_id:
      name: project_id
      in: path
      description: Project id
      required: true
      schema:
        type: string
        pattern: /^[0-9a-f]{24}$/i
    include_linked_styleguides:
      name: include_linked_styleguides
      in: query
      description: Whether to include linked styleguides or not
      required: false
      schema:
        type: boolean
        default: false
    styleguide_id:
      name: styleguide_id
      in: path
      description: Styleguide id
      required: true
      schema:
        type: string
        pattern: /^[0-9a-f]{24}$/i
    spacing_token_id:
      name: spacing_token_id
      in: path
      description: Spacing token id
      required: true
      schema:
        type: string
        pattern: /^[0-9a-f]{24}$/i
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: /v1/oauth/authorize
          tokenUrl: /v1/oauth/token
          refreshUrl: /v1/oauth/token
          scopes: {}
    PersonalAccessToken:
      type: http
      scheme: bearer
      bearerFormat: JWT