Gupy Operation Unit API

The Operation Unit API from Gupy, for operation unit.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 4

GET /os/v1/operation-units List operation units with pagination #
POST /os/v1/operation-units Create a new operation unit #
PUT /os/v1/operation-units/external/{externalCode} Update an operation unit by external code #
DELETE /os/v1/operation-units/external/{externalCode} Delete operation unit by external code #

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/gupy:gupy-operation-unit-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

gupy-operation-unit-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Gupy Admin Global Operation Unit API
  description: Public API for Estrutura Organizacional - Only requires Bearer token authentication. The central-company-id is automatically extracted from the token.
  version: '1.0'
  contact: {}
servers:
- url: https://api.gupy.io
tags:
- name: Operation Unit
paths:
  /os/v1/operation-units:
    get:
      description: Retrieves a paginated list of operation units for the company, including company and parent when applicable. When `externalCode` is provided, results are filtered to the unit with that exact external code. If nothing matches, `data` is empty and `total` is 0 (HTTP 200, not 404).
      operationId: OperationUnitPublicController_listAllOperationUnits_v1
      parameters:
      - name: externalCode
        required: false
        in: query
        description: Optional. Exact match on operation unit external code. Empty list when no match.
        schema:
          example: FILIAL-SUL
          type: string
      - name: page
        required: false
        in: query
        description: Page number for pagination
        schema:
          minimum: 1
          default: 1
          example: 1
          type: number
      - name: maxPageSize
        required: false
        in: query
        description: Maximum page size for pagination
        schema:
          minimum: 1
          maximum: 100
          default: 10
          example: 20
          type: number
      responses:
        '200':
          description: Operation units retrieved successfully
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/ApiResponseDto'
                - properties:
                    result:
                      type: object
                      properties:
                        data:
                          type: array
                          items:
                            $ref: '#/components/schemas/ListOperationUnitsPublicItemDto'
                        page:
                          type: number
                        maxPageSize:
                          type: number
                        total:
                          type: number
                        totalPages:
                          type: number
                      required:
                      - data
                      - page
                      - maxPageSize
                      - total
                      - totalPages
        '400':
          description: Bad Request - Invalid query parameters
          content:
            application/json:
              examples:
                invalidPage:
                  summary: Invalid page parameter
                  value:
                    statusCode: 400
                    timestamp: '2025-05-29T21:00:00.000Z'
                    path: /os/v1/operation-units
                    method: GET
                    title: BadRequestException
                    message: Validation failed
                    errors:
                    - code: BadRequestException
                      target: ValidationPipe
                      message: externalCode should not be empty
                invalidMaxPageSize:
                  summary: Invalid maxPageSize parameter
                  value:
                    statusCode: 400
                    timestamp: '2025-05-29T21:00:00.000Z'
                    path: /os/v1/operation-units
                    method: GET
                    title: BadRequestException
                    message: Validation failed
                    errors:
                    - code: BadRequestException
                      target: ValidationPipe
                      message: maxPageSize must not be greater than 100
        '401':
          description: Unauthorized - Invalid or missing token
          content:
            application/json:
              example:
                statusCode: 401
                timestamp: '2026-05-25T17:24:50.463Z'
                path: /v1/resource
                method: GET
                title: UnauthorizedException
                message: Unauthorized
                errors:
                - code: UnauthorizedException
                  target: UnauthorizedException
                  message: Unauthorized
        '500':
          description: Internal Server Error - Unexpected failure
          content:
            application/json:
              example:
                statusCode: 500
                timestamp: '2026-05-25T17:24:50.463Z'
                path: /v1/resource
                method: GET
                title: InternalServerErrorException
                message: Unexpected error occurred
                errors:
                - code: UnprocessableEntityException
                  target: Server
                  message: An unexpected error occurred. Please try again later.
      security:
      - bearer: []
      - central-company-id: []
      - company-uuid: []
      summary: List operation units with pagination
      tags:
      - Operation Unit
    post:
      description: Creates an operation unit for the current company. Only name and externalCode are required.
      operationId: OperationUnitPublicController_create_v1
      parameters: []
      requestBody:
        required: true
        description: 'Operation unit creation data. Required fields: name, externalCode.'
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOperationUnitPublicRequestDto'
      responses:
        '201':
          description: Operation unit successfully created
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/ApiResponseDto'
                - properties:
                    result:
                      $ref: '#/components/schemas/OperationUnitResponseDto'
        '401':
          description: Unauthorized - Invalid or missing token
          content:
            application/json:
              example:
                statusCode: 401
                timestamp: '2026-05-25T17:24:50.463Z'
                path: /v1/operation-units
                method: POST
                title: UnauthorizedException
                message: Unauthorized
                errors:
                - code: UnauthorizedException
                  target: UnauthorizedException
                  message: Unauthorized
        '500':
          description: Internal Server Error - Unexpected failure
          content:
            application/json:
              example:
                statusCode: 500
                timestamp: '2026-05-25T17:24:50.463Z'
                path: /v1/operation-units
                method: POST
                title: InternalServerErrorException
                message: Unexpected error occurred
                errors:
                - code: UnprocessableEntityException
                  target: Server
                  message: An unexpected error occurred. Please try again later.
      security:
      - bearer: []
      - central-company-id: []
      - company-uuid: []
      summary: Create a new operation unit
      tags:
      - Operation Unit
  /os/v1/operation-units/external/{externalCode}:
    put:
      description: 'Updates an operation unit identified by `externalCode` in the URL path.


        **Public contract:** parent is nested as `parent.externalCode` (not a root `externalCodeParent`). Send `parent: null` or `parent: ""` to clear the parent; if `parent` is an object, `externalCode` must be a non-empty string (null, empty string, or omitting `externalCode` is invalid).


        **Errors:** `404` not found for path code; `409` duplicate body `externalCode` or invalid parent reference (e.g. self-parent); `422` parent external code not found.'
      operationId: OperationUnitPublicController_updateByExternalCode_v1
      parameters:
      - name: externalCode
        required: true
        in: path
        description: External code of the operation unit to update
        schema:
          example: SP-001
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOperationUnitByExternalCodeRequestDto'
            examples:
              full:
                summary: All fields with parent
                value:
                  externalCode: SP-001
                  name: Matriz São Paulo
                  address: Av. Paulista, 1000
                  businessRegistrationNumber: '96925786000127'
                  parent:
                    externalCode: ROOT-001
              clearOptionals:
                summary: Clear optional scalars and parent
                value:
                  externalCode: SP-001
                  name: Matriz São Paulo
                  address: null
                  businessRegistrationNumber: ''
                  parent: null
      responses:
        '200':
          description: Operation unit updated successfully
          content:
            application/json:
              example:
                result:
                  externalCode: SP-001
                  name: Matriz São Paulo
                  address: Av. Paulista, 1000
                  businessRegistrationNumber: '96925786000127'
                  parent:
                    externalCode: ROOT-001
        '400':
          description: Bad Request — validation errors (e.g. ValidationPipe), or invalid CNPJ / `businessRegistrationNumber` (Business registration number needs to be a valid cnpj number).
        '401':
          description: Unauthorized - Invalid or missing token
          content:
            application/json:
              example:
                statusCode: 401
                timestamp: '2026-05-25T17:24:50.464Z'
                path: /os/v1/operation-units/external/SP-001
                method: PUT
                title: UnauthorizedException
                message: Unauthorized
                errors:
                - code: UnauthorizedException
                  target: UnauthorizedException
                  message: Unauthorized
        '404':
          description: No operation unit was found for the given external code in this company
        '409':
          description: Another operation unit in the company already uses this external code, or An operation unit cannot be its own parent
        '422':
          description: No operation unit exists for the company with the parent external code provided
        '500':
          description: Internal Server Error - Unexpected failure
          content:
            application/json:
              example:
                statusCode: 500
                timestamp: '2026-05-25T17:24:50.464Z'
                path: /os/v1/operation-units/external/SP-001
                method: PUT
                title: InternalServerErrorException
                message: Unexpected error occurred
                errors:
                - code: UnprocessableEntityException
                  target: Server
                  message: An unexpected error occurred. Please try again later.
      security:
      - bearer: []
      - central-company-id: []
      - company-uuid: []
      summary: Update an operation unit by external code
      tags:
      - Operation Unit
    delete:
      description: 'Deletes an operation unit by its external code.


        An operation unit cannot be deleted if it has active relationships with position(s) or child operation units.'
      operationId: OperationUnitPublicController_deleteByExternalCode_v1
      parameters:
      - name: externalCode
        required: true
        in: path
        description: The external code of the operation unit to delete
        schema:
          type: string
          maxLength: 50
      responses:
        '200':
          description: The Operation Unit has been successfully deleted (HTTP 200; handler returns no payload).
        '401':
          description: Unauthorized - Invalid or missing token
          content:
            application/json:
              example:
                statusCode: 401
                timestamp: '2026-05-25T17:24:50.464Z'
                path: /os/v1/operation-units/external/{externalCode}
                method: DELETE
                title: UnauthorizedException
                message: Unauthorized
                errors:
                - code: UnauthorizedException
                  target: UnauthorizedException
                  message: Unauthorized
        '404':
          description: Not Found - Operation unit not found
          content:
            application/json:
              example:
                statusCode: 404
                timestamp: '2025-05-29T21:00:00.000Z'
                path: /os/v1/operation-units/external/{externalCode}
                method: DELETE
                title: NotFoundException
                message: Operation unit with external code OU-MISSING was not found
                errors:
                - code: NOT_FOUND
                  target: NotFoundException
                  message: Operation unit with external code OU-MISSING was not found
        '422':
          description: Unprocessable Entity - Operation unit has active dependencies
          content:
            application/json:
              example:
                statusCode: 422
                timestamp: '2025-05-29T21:00:00.000Z'
                path: /os/v1/operation-units/external/{externalCode}
                method: DELETE
                title: UnprocessableEntityException
                message: 'The operation unit cannot be deleted: active relationships with 1 position(s)'
                errors:
                - code: OPERATION_UNIT_HAS_ACTIVE_DEPENDENCIES
                  target: UnprocessableEntityException
                  message: 'The operation unit cannot be deleted: active relationships with 1 position(s)'
        '500':
          description: Internal Server Error - Unexpected failure
          content:
            application/json:
              example:
                statusCode: 500
                timestamp: '2026-05-25T17:24:50.464Z'
                path: /os/v1/operation-units/external/{externalCode}
                method: DELETE
                title: InternalServerErrorException
                message: Unexpected error occurred
                errors:
                - code: UnprocessableEntityException
                  target: Server
                  message: An unexpected error occurred. Please try again later.
      security:
      - bearer: []
      - central-company-id: []
      - company-uuid: []
      summary: Delete operation unit by external code
      tags:
      - Operation Unit
components:
  schemas:
    OperationUnitResponseDto:
      type: object
      properties:
        uuid:
          type: string
          description: operation unit UUID
          format: uuid
        name:
          type: string
          description: operation unit name
          example: Matriz São Paulo
        externalCode:
          type: string
          description: operation unit external code
          example: SP001
        address:
          type: string
          description: operation unit address
          example: Av. Paulista, 1000 - São Paulo, SP
        businessRegistrationNumber:
          type: string
          description: operation unit business registration number
          example: 12.345.678/0001-90
        company:
          description: operation unit company
          allOf:
          - $ref: '#/components/schemas/CompanyDto'
        parent:
          description: parent operation unit
          allOf:
          - $ref: '#/components/schemas/OperationUnitResponseDto'
      required:
      - uuid
      - name
      - externalCode
      - company
    CreateOperationUnitPublicRequestDto:
      type: object
      properties:
        name:
          type: string
          maxLength: 300
          description: operation unit name
          example: Matriz Sao Paulo
        externalCode:
          type: string
          maxLength: 50
          description: operation unit external code
          example: SP001
        address:
          type: string
          maxLength: 600
          description: operation unit address
          example: Av. Paulista, 1000 - Sao Paulo, SP
        businessRegistrationNumber:
          type: string
          pattern: /^(\d{14}|\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2})$/
          description: operation unit business registration number (CNPJ)
          example: 12.345.678/0001-90
        externalCodeParent:
          type: string
          maxLength: 50
          description: parent operation unit external code
          example: SP000
      required:
      - name
      - externalCode
    ApiResponseDto:
      type: object
      properties:
        result:
          type: object
          description: Result data
        path:
          type: string
          description: Request path
        duration:
          type: string
          description: Request duration
        method:
          type: string
          description: HTTP method used
          enum:
          - GET
          - POST
          - PUT
          - DELETE
          - PATCH
      required:
      - result
      - path
      - duration
      - method
    OperationUnitParentPublicSummaryDto:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        externalCode:
          type: string
        name:
          type: string
      required:
      - uuid
      - externalCode
      - name
    UpdateOperationUnitByExternalCodeRequestDto:
      type: object
      properties:
        externalCode:
          type: string
          maxLength: 50
          example: SP-001
        name:
          type: string
          maxLength: 300
          example: Matriz São Paulo
        address:
          type:
          - string
          - 'null'
          maxLength: 600
          description: Use null or empty string to clear
        businessRegistrationNumber:
          type:
          - string
          - 'null'
          maxLength: 18
          description: CNPJ; use null or empty string to clear
        parent:
          description: '`null` or empty string clears the parent link. If you send an object, it must include a non-empty `externalCode` string.'
          allOf:
          - $ref: '#/components/schemas/UpdateOperationUnitByExternalCodeParentInputDto'
      required:
      - externalCode
      - name
      - address
      - businessRegistrationNumber
      - parent
    ListOperationUnitsPublicItemDto:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
        name:
          type: string
        externalCode:
          type: string
        address:
          type: string
        businessRegistrationNumber:
          type: string
        company:
          $ref: '#/components/schemas/CompanyDto'
        parent:
          allOf:
          - $ref: '#/components/schemas/OperationUnitParentPublicSummaryDto'
      required:
      - uuid
      - name
      - externalCode
      - company
    UpdateOperationUnitByExternalCodeParentInputDto:
      type: object
      properties:
        externalCode:
          type: string
          maxLength: 50
          description: 'Parent operation unit external code. Required when `parent` is an object. To clear the parent, send `parent: null` on the request body (do not use null or empty string here).'
          example: OU-PARENT
      required:
      - externalCode
    CompanyDto:
      type: object
      properties:
        id:
          type: string
          description: Internal company ID
          example: '1'
        uuid:
          type: string
          description: company UUID
          format: uuid
        centralCompanyId:
          type: string
          description: central company UUID
          format: uuid
        name:
          type: string
          description: company name
          example: Gupy
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
x-provenance:
  method: searched
  source: https://developers.gupy.io/reference
  harvested: '2026-12-03'
  tool: harvest-readme-openapi.py
  note: Assembled verbatim from the OpenAPI definition ReadMe embeds in each operation page of the provider's developer portal; paths and components merged by API title, nothing authored.
  assembled_from:
  - https://developers.gupy.io/reference/areapubliccontroller_create_v1.md
  - https://developers.gupy.io/reference/areapubliccontroller_deletebyexternalcode_v1.md
  - https://developers.gupy.io/reference/areapubliccontroller_listallareas_v1.md
  - https://developers.gupy.io/reference/areapubliccontroller_update_v1.md
  - https://developers.gupy.io/reference/costcenterpubliccontroller_create_v1.md
  - https://developers.gupy.io/reference/costcenterpubliccontroller_deletecostcenter_v1.md
  - https://developers.gupy.io/reference/costcenterpubliccontroller_findcostcenterbyuuid_v1.md
  - https://developers.gupy.io/reference/costcenterpubliccontroller_findcostcenters_v1.md
  - https://developers.gupy.io/reference/costcenterpubliccontroller_update_v1.md
  - https://developers.gupy.io/reference/operationunitpubliccontroller_create_v1.md
  - https://developers.gupy.io/reference/operationunitpubliccontroller_deletebyexternalcode_v1.md
  - https://developers.gupy.io/reference/operationunitpubliccontroller_listalloperationunits_v1.md
  - https://developers.gupy.io/reference/operationunitpubliccontroller_updatebyexternalcode_v1.md
  - https://developers.gupy.io/reference/organizationunitpubliccontroller_create_v1.md
  - https://developers.gupy.io/reference/organizationunitpubliccontroller_deletedepartment_v1.md
  - https://developers.gupy.io/reference/organizationunitpubliccontroller_findorganizationunitbyuuid_v1.md
  - https://developers.gupy.io/reference/organizationunitpubliccontroller_findorganizationunits_v1.md
  - https://developers.gupy.io/reference/organizationunitpubliccontroller_update_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_create_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_createbatch_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_createpositionreplication_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_deleteposition_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_deletepositionbyemployee_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_findpositions_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_updateposition_v1.md
  - https://developers.gupy.io/reference/positionpubliccontroller_updatepositionbyemployee_v1.md
  - https://developers.gupy.io/reference/rolepubliccontroller_create_v1.md
  - https://developers.gupy.io/reference/rolepubliccontroller_delete_v1.md
  - https://developers.gupy.io/reference/rolepubliccontroller_listroles_v1.md
  - https://developers.gupy.io/reference/rolepubliccontroller_update_v1.md
  merge:
    pages: 30
    deduped: 67
    conflicts_kept_first: 0