Codacy Segments API

The segments API from Codacy — 5 operation(s) for segments.

Operations 6

GET /organizations/{provider}/{remoteOrganizationName}/segments/sync Get the status of the segments synchronization #
POST /organizations/{provider}/{remoteOrganizationName}/segments/sync Synchronize the segments of the organization with the Git provider #
GET /organizations/{provider}/{remoteOrganizationName}/segments/keys Get the segment keys for the organization #
GET /organizations/{provider}/{remoteOrganizationName}/segments/keys/ids Get the segment keys with IDs for the organization #
GET /organizations/{provider}/{remoteOrganizationName}/segments/values/{segmentKey} Get segment values for a segment key #
GET /organizations/{provider}/{remoteOrganizationName}/segments/{segmentKey}/values Get the segment values for the organization by segment key #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/codacy:codacy-segments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

codacy-segments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Codacy Segments API
  description: 'Codacy API v3 reference.


    Import the OpenAPI 3.0.1 definition into your development tools to help bootstrap your integration with Codacy.

    For more information see Using the Codacy API.'
  contact:
    name: Codacy Team
    url: https://www.codacy.com
    email: code@codacy.com
  license:
    name: Codacy. All rights reserved
    url: https://www.codacy.com
  version: 3.1.0
servers:
- url: https://api.codacy.com/api/v3
security:
- ApiKeyAuth: []
tags:
- name: Segments
paths:
  /organizations/{provider}/{remoteOrganizationName}/segments/sync:
    get:
      tags:
      - Segments
      summary: Get the status of the segments synchronization
      operationId: getSegmentsSyncStatus
      parameters:
      - $ref: '#/components/parameters/providerParam'
      - $ref: '#/components/parameters/remoteOrganizationNameParam'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentsSyncStatusResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-jvm-package: segments
    post:
      tags:
      - Segments
      summary: Synchronize the segments of the organization with the Git provider
      description: For GitHub, segments are the repository custom properties
      operationId: syncSegments
      parameters:
      - $ref: '#/components/parameters/providerParam'
      - $ref: '#/components/parameters/remoteOrganizationNameParam'
      responses:
        '202':
          description: Sync already in progress
          content: {}
        '204':
          description: Successful operation
          content: {}
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-jvm-package: segments
  /organizations/{provider}/{remoteOrganizationName}/segments/keys:
    get:
      tags:
      - Segments
      summary: Get the segment keys for the organization
      operationId: getSegmentsKeys
      parameters:
      - $ref: '#/components/parameters/providerParam'
      - $ref: '#/components/parameters/remoteOrganizationNameParam'
      - $ref: '#/components/parameters/cursorParam'
      - $ref: '#/components/parameters/limitParam'
      - $ref: '#/components/parameters/searchParam'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentsKeysResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-jvm-package: segments
  /organizations/{provider}/{remoteOrganizationName}/segments/keys/ids:
    get:
      tags:
      - Segments
      summary: Get the segment keys with IDs for the organization
      operationId: getSegmentsKeysWithIds
      parameters:
      - $ref: '#/components/parameters/providerParam'
      - $ref: '#/components/parameters/remoteOrganizationNameParam'
      - $ref: '#/components/parameters/cursorParam'
      - $ref: '#/components/parameters/limitParam'
      - $ref: '#/components/parameters/searchParam'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentsKeysIdsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-jvm-package: segments
  /organizations/{provider}/{remoteOrganizationName}/segments/values/{segmentKey}:
    get:
      tags:
      - Segments
      summary: Get segment values for a segment key
      description: '**Deprecated:** Use getSegments instead.'
      deprecated: true
      operationId: getSegmentsValues
      parameters:
      - $ref: '#/components/parameters/providerParam'
      - $ref: '#/components/parameters/remoteOrganizationNameParam'
      - $ref: '#/components/parameters/cursorParam'
      - $ref: '#/components/parameters/segmentKeyPathParam'
      - $ref: '#/components/parameters/searchParam'
      - $ref: '#/components/parameters/limitParam'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentsResponseDeprecated'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-jvm-package: segments
  /organizations/{provider}/{remoteOrganizationName}/segments/{segmentKey}/values:
    get:
      tags:
      - Segments
      summary: Get the segment values for the organization by segment key
      operationId: getSegments
      parameters:
      - $ref: '#/components/parameters/providerParam'
      - $ref: '#/components/parameters/remoteOrganizationNameParam'
      - $ref: '#/components/parameters/segmentKeyPathParam'
      - $ref: '#/components/parameters/cursorParam'
      - $ref: '#/components/parameters/searchParam'
      - $ref: '#/components/parameters/limitParam'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-jvm-package: segments
components:
  schemas:
    NotFound:
      allOf:
      - $ref: '#/components/schemas/ApiError'
      - required:
        - error
        type: object
        properties:
          error:
            type: string
            default: NotFound
    SegmentKeyWithId:
      required:
      - id
      - key
      type: object
      properties:
        id:
          type: integer
          description: Segment id
          format: int64
        key:
          type: string
          description: Segment key
          example: group
      description: Segment keys and id pair
    SegmentEntryDeprecated:
      required:
      - id
      - name
      - value
      type: object
      properties:
        id:
          type: integer
          description: Identifier of the segment
          format: int64
          example: 1
        name:
          type: string
          description: Name of the segment. Specific to the organization.
          example: group-id
        value:
          type: string
          description: Value of the segment
          example: common libraries
        description:
          type: string
          description: Description of the segment
          example: Group of common libraries for projects
      description: Segment of an organization.
    ApiError:
      required:
      - actions
      - message
      type: object
      properties:
        message:
          type: string
        innerMessage:
          type: string
        actions:
          type: array
          items:
            $ref: '#/components/schemas/ProblemLink'
    Forbidden:
      allOf:
      - $ref: '#/components/schemas/ApiError'
      - required:
        - error
        type: object
        properties:
          error:
            type: string
            default: Forbidden
    SegmentsKeysIdsResponse:
      required:
      - data
      type: object
      properties:
        pagination:
          $ref: '#/components/schemas/PaginationInfo'
        data:
          type: array
          items:
            $ref: '#/components/schemas/SegmentKeyWithId'
    BadRequest:
      allOf:
      - $ref: '#/components/schemas/ApiError'
      - required:
        - error
        type: object
        properties:
          error:
            type: string
            default: BadRequest
    SegmentsKeysResponse:
      required:
      - data
      type: object
      properties:
        pagination:
          $ref: '#/components/schemas/PaginationInfo'
        data:
          type: array
          items:
            type: string
            example: group-id
    UnprocessableEntity:
      allOf:
      - $ref: '#/components/schemas/ApiError'
      - required:
        - error
        type: object
        properties:
          error:
            type: string
            default: UnprocessableEntity
    SegmentsResponseDeprecated:
      required:
      - data
      type: object
      properties:
        pagination:
          $ref: '#/components/schemas/PaginationInfo'
        data:
          type: array
          items:
            $ref: '#/components/schemas/SegmentEntryDeprecated'
    SegmentsResponse:
      required:
      - data
      type: object
      properties:
        pagination:
          $ref: '#/components/schemas/PaginationInfo'
        data:
          type: array
          items:
            $ref: '#/components/schemas/SegmentEntry'
    InternalServerError:
      allOf:
      - $ref: '#/components/schemas/ApiError'
      - required:
        - error
        type: object
        properties:
          error:
            type: string
            default: InternalServerError
    PaginationInfo:
      type: object
      properties:
        cursor:
          type: string
          description: Cursor to [request the next batch of results](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)
        limit:
          type: integer
          description: Maximum number of items returned
          format: int32
        total:
          type: integer
          description: Total number of items returned
          format: int32
      description: Cursor-based pagination information to obtain more items
    ProblemLink:
      required:
      - name
      - url
      type: object
      properties:
        name:
          type: string
          example: Check our documentation
        url:
          type: string
          example: https://docs.codacy.com/faq/troubleshooting/why-isnt-my-public-repository-being-analyzed/
    SegmentEntry:
      required:
      - id
      - name
      type: object
      properties:
        id:
          type: integer
          description: Identifier of the segment
          format: int64
          example: 1
        name:
          type: string
          description: Name of the segment. Specific to the organization.
          example: group-id
        value:
          type: string
          description: Value of the segment
          example: common libraries
        description:
          type: string
          description: Description of the segment
          example: Group of common libraries for projects
      description: Segment of an organization.
    SegmentsSyncStatusResponse:
      required:
      - status
      type: object
      properties:
        status:
          type: string
          description: Status of the segments synchronization process. Valid values are `Syncing`, `Completed`, `Error`, `NotSynced`.
          example: Syncing
        error:
          type: string
          example: Error message
    Unauthorized:
      allOf:
      - $ref: '#/components/schemas/ApiError'
      - required:
        - code
        - error
        type: object
        properties:
          error:
            type: string
            default: Unauthorized
          code:
            type: string
            default: Unauthorized
  responses:
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFound'
      x-ms-error-response: true
    UnprocessableEntity:
      description: Unprocessable Entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnprocessableEntity'
      x-ms-error-response: true
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Forbidden'
      x-ms-error-response: true
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequest'
      x-ms-error-response: true
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
      x-ms-error-response: true
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
      x-ms-error-response: true
  parameters:
    remoteOrganizationNameParam:
      name: remoteOrganizationName
      in: path
      description: Organization name on the Git provider
      required: true
      schema:
        type: string
        x-ms-parameter-location: method
      example: codacy
      x-ms-parameter-location: method
    cursorParam:
      name: cursor
      in: query
      description: Cursor to [specify a batch of results to request](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)
      schema:
        type: string
        x-ms-parameter-location: method
      example: Yms345gh==
      x-ms-parameter-location: method
    searchParam:
      name: search
      in: query
      description: Filter results by searching for this string
      schema:
        type: string
        x-ms-parameter-location: method
      example: my-repository-name
      x-ms-parameter-location: method
    providerParam:
      name: provider
      in: path
      description: Git provider identifier (e.g., gh for GitHub, gl for GitLab, bb for Bitbucket)
      required: true
      schema:
        type: string
        x-ms-parameter-location: method
      example: gh
      x-ms-parameter-location: method
    limitParam:
      name: limit
      in: query
      description: Maximum number of items to return
      schema:
        maximum: 100
        minimum: 1
        type: integer
        format: int32
        default: 100
        x-ms-parameter-location: method
      example: 20
      x-ms-parameter-location: method
    segmentKeyPathParam:
      name: segmentKey
      in: path
      description: Unique key identifier for the segment
      required: true
      schema:
        type: string
        x-ms-parameter-location: method
      example: my-group
      x-ms-parameter-location: method
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Learn how to [generate an account API token](https://docs.codacy.com/codacy-api/api-tokens/#account-api-tokens)
      name: api-token
      in: header
    ProjectTokenAuth:
      type: apiKey
      name: project-token
      in: header
      description: 'Repository API token. Accepted only by repository-scoped operations that declare it.

        Create one with [createRepositoryApiToken](#createrepositoryapitoken)

        '
x-provenance:
  method: harvested
  publisher: Codacy
  source: https://api.codacy.com/api/api-docs/swagger.yaml
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)