openapi: 3.0.3 info: title: SmartHR Business Establishments Custom Field Templates API description: 'The SmartHR API is a per-tenant REST API for the SmartHR cloud HR / labor and personnel management platform (smarthr.jp). It exposes an organization''s employee ("crew") records and the master data around them - departments, employment types, custom field templates, business establishments - plus webhook subscriptions for change notifications. The API is served from each customer''s own tenant subdomain (https://{tenant}.smarthr.jp/api) and all resources live under the /v1 path. Authentication is a per-tenant access token passed as a Bearer token (or via HTTP Basic with the token as the username). This document models a representative, grounded subset of the API. The endpoints below are confirmed against SmartHR''s published API reference and the community Go SDK (github.com/ktsujichan/smarthr-sdk-go). SmartHR''s full API reference documents additional resources (dependents, bank accounts, payrolls, positions, job titles, tags, companies, and more) that are not modeled here.' version: '1.0' contact: name: SmartHR for Developers url: https://developer.smarthr.jp/ termsOfService: https://developer.smarthr.jp/terms/index.html servers: - url: https://{tenant}.smarthr.jp/api description: Production tenant. Replace {tenant} with your SmartHR subdomain. Each customer has their own subdomain; there is no single shared host. variables: tenant: default: your-subdomain description: The customer's SmartHR tenant subdomain. security: - bearerAuth: [] tags: - name: Custom Field Templates description: Templates defining custom fields attached to crew records. paths: /v1/crew_custom_field_templates: get: operationId: listCrewCustomFieldTemplates tags: - Custom Field Templates summary: List crew custom field templates description: Lists the custom field templates that define additional fields attached to crew records for the tenant. parameters: - $ref: '#/components/parameters/Page' - $ref: '#/components/parameters/PerPage' responses: '200': description: A page of custom field templates. headers: x-total-count: $ref: '#/components/headers/XTotalCount' content: application/json: schema: type: array items: $ref: '#/components/schemas/CrewCustomFieldTemplate' '401': $ref: '#/components/responses/Unauthorized' '429': $ref: '#/components/responses/TooManyRequests' post: operationId: createCrewCustomFieldTemplate tags: - Custom Field Templates summary: Create a crew custom field template description: Creates a new crew custom field template. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CrewCustomFieldTemplateInput' responses: '201': description: The created custom field template. content: application/json: schema: $ref: '#/components/schemas/CrewCustomFieldTemplate' '401': $ref: '#/components/responses/Unauthorized' '422': $ref: '#/components/responses/ValidationError' '429': $ref: '#/components/responses/TooManyRequests' /v1/crew_custom_field_templates/{id}: parameters: - $ref: '#/components/parameters/Id' get: operationId: getCrewCustomFieldTemplate tags: - Custom Field Templates summary: Get a crew custom field template description: Retrieves a single crew custom field template by ID. responses: '200': description: The requested custom field template. content: application/json: schema: $ref: '#/components/schemas/CrewCustomFieldTemplate' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' patch: operationId: updateCrewCustomFieldTemplate tags: - Custom Field Templates summary: Update a crew custom field template description: Updates an existing crew custom field template. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CrewCustomFieldTemplateInput' responses: '200': description: The updated custom field template. content: application/json: schema: $ref: '#/components/schemas/CrewCustomFieldTemplate' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationError' '429': $ref: '#/components/responses/TooManyRequests' delete: operationId: deleteCrewCustomFieldTemplate tags: - Custom Field Templates summary: Delete a crew custom field template description: Deletes a crew custom field template. responses: '204': description: The custom field template was deleted. '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '429': $ref: '#/components/responses/TooManyRequests' components: schemas: CrewCustomFieldTemplate: allOf: - $ref: '#/components/schemas/CrewCustomFieldTemplateInput' - type: object properties: id: type: string created_at: type: string format: date-time updated_at: type: string format: date-time Error: type: object properties: code: type: integer type: type: string message: type: string errors: type: array items: type: object additionalProperties: true CrewCustomFieldTemplateInput: type: object required: - name - type properties: name: type: string type: type: string description: Field type. enum: - text - text_area - number - date - enum - file group_id: type: string description: ID of the custom field template group this field belongs to. elements: type: array description: Choice elements for enum-type fields. items: type: object properties: name: type: string position: type: integer parameters: Page: name: page in: query required: false description: Page number, starting at 1. schema: type: integer minimum: 1 default: 1 Id: name: id in: path required: true description: The unique identifier of the resource. schema: type: string PerPage: name: per_page in: query required: false description: Number of records per page (max 100). schema: type: integer minimum: 1 maximum: 100 default: 10 responses: NotFound: description: The requested resource was not found. content: application/json: schema: $ref: '#/components/schemas/Error' Unauthorized: description: Missing or invalid access token. content: application/json: schema: $ref: '#/components/schemas/Error' ValidationError: description: The request payload failed validation. content: application/json: schema: $ref: '#/components/schemas/Error' TooManyRequests: description: Rate limit exceeded. SmartHR allows 5,000 requests/hour and 10 requests/second per access token, and 50,000 requests/minute per subdomain. content: application/json: schema: $ref: '#/components/schemas/Error' headers: XTotalCount: description: Total number of records matching the query. schema: type: integer securitySchemes: bearerAuth: type: http scheme: bearer description: 'Per-tenant access token issued from the SmartHR admin console (or obtained via OAuth2 for registered apps), passed as `Authorization: Bearer ACCESS_TOKEN`. HTTP Basic auth with the access token as the username (`curl -u ACCESS_TOKEN`) is also accepted.'