TravelPerk Cost Centers API

Cost center management and user assignment.

Documentation

Specifications

Other Resources

OpenAPI Specification

travelperk-cost-centers-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: TravelPerk Cost Centers API
  description: Specification of the TravelPerk Open API. TravelPerk is a business-travel management platform; its REST API exposes trips and bookings, invoices and invoice lines, invoice profiles, cost centers, traveler/member provisioning (SCIM 2.0), and webhooks. Requests are authenticated with an OAuth 2.0 access token (or API key) passed in the Authorization header, and an `Api-Version` header selects the API version.
  termsOfService: https://www.travelperk.com/legal/terms-of-service/
  contact:
    name: TravelPerk Developer Support
    url: https://developers.travelperk.com
  version: '1'
servers:
- url: https://api.travelperk.com
  description: TravelPerk production API
- url: https://api.sandbox-travelperk.com
  description: TravelPerk sandbox API
security:
- bearerAuth: []
- apiKeyAuth: []
tags:
- name: Cost Centers
  description: Cost center management and user assignment.
paths:
  /cost_centers:
    get:
      operationId: listCostCenters
      tags:
      - Cost Centers
      summary: List all cost centers
      description: Lists all cost centers in your organization. Returns a paginated list with offset and limit controls.
      parameters:
      - name: offset
        in: query
        required: false
        schema:
          type: integer
      - name: limit
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: A paginated list of cost centers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostCenterList'
    post:
      operationId: createCostCenter
      tags:
      - Cost Centers
      summary: Create cost center
      description: Creates a cost center with the specified name. You can optionally set an approver, delegate, and delegate expiry date.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CostCenterInput'
      responses:
        '201':
          description: The created cost center.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostCenter'
  /cost_centers/bulk_update:
    patch:
      operationId: bulkUpdateCostCenters
      tags:
      - Cost Centers
      summary: Bulk update cost centers
      description: Archives or unarchives a list of cost centers in a single request. Returns the number of cost centers updated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                cost_center_ids:
                  type: array
                  items:
                    type: string
                archived:
                  type: boolean
      responses:
        '200':
          description: The number of cost centers updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  updated:
                    type: integer
  /cost_centers/{id}:
    get:
      operationId: getCostCenter
      tags:
      - Cost Centers
      summary: Get cost center
      description: Retrieves a cost center by its ID, including assigned users, approver, delegate, and company scope.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: The requested cost center.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostCenter'
    patch:
      operationId: updateCostCenter
      tags:
      - Cost Centers
      summary: Update cost center
      description: Updates a cost center. You can update the name, archive status, approver, delegate, and delegate expiry.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CostCenterInput'
      responses:
        '200':
          description: The updated cost center.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostCenter'
  /cost_centers/{id}/users:
    put:
      operationId: setCostCenterUsers
      tags:
      - Cost Centers
      summary: Set users to a cost center
      description: Replaces all users assigned to the cost center with the provided list. Any users not in the list are removed from the cost center.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                user_ids:
                  type: array
                  items:
                    type: integer
      responses:
        '200':
          description: The updated cost center with its user assignments.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostCenter'
components:
  schemas:
    CostCenter:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        archived:
          type: boolean
        approver_id:
          type: integer
        delegate_id:
          type: integer
        delegate_expiry:
          type: string
          format: date
        users:
          type: array
          items:
            type: integer
    CostCenterInput:
      type: object
      required:
      - name
      properties:
        name:
          type: string
        archived:
          type: boolean
        approver_id:
          type: integer
        delegate_id:
          type: integer
        delegate_expiry:
          type: string
          format: date
    CostCenterList:
      type: object
      properties:
        total:
          type: integer
        offset:
          type: integer
        data:
          type: array
          items:
            $ref: '#/components/schemas/CostCenter'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: token
      description: 'OAuth 2.0 access token obtained via the Authorization Code grant, passed as `Authorization: Bearer <token>`.'
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Personal API key passed as `Authorization: ApiKey <key>` for customer (non-partner) integrations.'