TalentLMS Branch API

The Branch API from TalentLMS — 5 operation(s) for branch.

OpenAPI Specification

talentlms-branch-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: TalentLMS Public Batch Actions Branch API
  description: "TalentLMS offers a range of API endpoints and resources designed to integrate TalentLMS with your internal systems seamlessly. It is organized around Representational State Transfer (REST) and is built to leverage standard HTTP features such as HTTP authentication and HTTP response codes, ensuring seamless integration. All API responses, including error messages, are consistently formatted in JSON for easy parsing and handling.\n\nIf your TalentLMS domain is called “samples”, then the API endpoint for your domain is [<code>https://samples.talentlms.com/api/v2</code>](https://samples.talentlms.com/api).\n\nThe current version of the API consumes data – information about users, courses, categories, groups, branches, and general details about your domain. Apart from that, via the API you can log in / sign up a user in your domain, enroll a user in a course, and much more. Please make sure, that you are accessing the URLs below, under HTTPs connections, otherwise, you will receive an error.\n\n## \U0001F680 **Getting Started Guide**\n\nTo start using the TalentLMS API, you must first [enable the API and generate a valid API](https://help.talentlms.com/hc/en-us/articles/9651527213468-Can-I-integrate-my-site-with-TalentLMS-Do-you-offer-an-API) key from the portal's settings (Account & Settings > Integrations > API).\n\n**Keep in mind:**\n\n- The pagination limit of each request is 100.\n    \n- The API has rate and usage limits (e.g. 2000 requests per hour).\n    \n- The API returns request responses in JSON format. When an API request returns an error, it is sent in the JSON response as an error key (All calls must have an Accept: application/json header value).\n    \n- In each request you must add the desired version of the API by adding the header option with the key `X-API-Version` and value (the format of the version must be `YYYY-MM-DD`).\n    \n## \U0001F510 Authentication\n\nAll of the requests require authentication. Our API uses the `API Key` authorization method, with key `X-API-Key` and value `your_api_key`. You can always fill these fields in the global variables or create an environment and insert them there.\n\n### ⛔️ Authentication error response\n\nYou will receive an HTTP 401 Unauthorized response code if the API key is missing, incorrectly formatted, or invalid.\n\n### ✅ API Responses\n\nTalentLMS API uses HTTP response codes to indicate the success or failure of requests. Specifically, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that resulted from the provided arguments (e.g. instead of an integer a string is supplied), and the 500 error code indicates an internal TalentLMS error. Please be aware that you will receive an error too, in case you try to access an endpoint via non HTTPs connection.\n\nAll errors return JSON consisting of a type (invalid_request_error or api_error) and a message describing the error.\n\n| **Code** | **Description** |\n| --- | --- |\n| 200 | The request was executed properly and a JSON response is returned. |\n| 204 | No content, and the operation was executed successfully. |\n| 400 | A required parameter is missing or an invalid type (e.g. a string) was supplied instead of an integer. |\n| 401 | Invalid API key provided. |\n| 403 | API is not enabled for the specified domain or the domain is currently inactive. |\n| 404 | The requested resource (e.g. user) does not exist. |\n| 422 | Malformed response. |\n| 429 | The API request rate limit has been exceeded. |\n| 500 | Internal server error. |\n\n### \U0001F6D1 Rate Limits\n\nRate limits represent the maximum number of API requests that are permitted to be made  \nper hour. These limits depend on your subscription plan and are as follows:\n\n| **Plan** | **Limit** |\n| --- | --- |\n| Core | 2.000 |\n| Grow | 10.000 |\n| Pro | 10.000 |\n| Small | 2.000 |\n| Basic | 2.000 |\n| Plus | 10.000 |\n| Premium | 10.000 |\n| Custom | Contact us so we can create a plan that fits your needs |\n\nRegardless of the total API requests per hour provisioned per customer, each customer's API requests should not exceed the rate of 200 API calls per 5 seconds. The following headers are included in API responses to help manage rate limits:\n\n- **`X-RateLimit-Limit`**: The maximum number of requests allowed in the current time window\n    \n- **`X-RateLimit-Remaining`**: The number of requests left in the current window before hitting the limit\n    \n### \U0001F4C4 Pagination\n\nOur API supports pagination, splitting responses into size-customizable chunks of up to 100 items per request. You can navigate to the first, last, previous, or next page. The endpoints that support pagination return a list formatted as shown below:\n\n``` json\n{\n        \"self\": \"https://example.talentlms.com/api/v2/users?page[number]=1&page[size]=10\",\n        \"first\": \"https://example.talentlms.com/api/v2/users?page[number]=1&page[size]=10\",\n        \"last\": \"https://example.talentlms.com/api/v2/users?page[number]=4&page[size]=10\",\n        \"prev\": \"https://example.talentlms.com/api/v2/users?page[number]=1&page[size]=10\",\n        \"next\": \"https://example.talentlms.com/api/v2/users?page[number]=2&page[size]=10\"\n}\n\n ```"
  version: 1.0.0
servers:
- url: https://your-domain.talentlms.com
security:
- apikeyAuth: []
tags:
- name: Branch
paths:
  /api/v2/branches:
    get:
      tags:
      - Branch
      summary: List all branches
      description: '### List all branches


        Retrieves a paginated list of all branches in your TalentLMS account. Upon a successful request, the API returns a JSON response containing branch objects, including their associated metadata and configuration details. Results are delivered in a paginated format to ensure efficient handling of large datasets.'
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
    post:
      tags:
      - Branch
      summary: Create a branch
      description: '### Create a branch


        Creates a new branch in your TalentLMS account. To successfully create a branch, provide the required branch attributes in the request body as a JSON object. If the request is valid, the API creates the branch and returns the newly created branch details, including its unique identifier.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                name: <string>
                description: <string>
                default_locale: <string>
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
  /api/v2/branches/:id:
    get:
      tags:
      - Branch
      summary: Get a branch
      description: '### Get a branch


        Retrieves the full details of a specific branch. To successfully fetch a branch, include the branch’s unique ID as a path parameter in the request URL. If the request is valid and the branch exists, the API returns detailed information about the branch, including its configuration settings and metadata.'
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
      - Branch
      summary: Delete a branch
      description: '### Delete a branch


        Permanently deletes a specific branch from your TalentLMS account. To successfully remove a branch, include the branch’s unique ID as a path parameter in the request URL. If the request is valid and the branch exists, the API deletes the branch and returns a **204 No Content** response upon success.'
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
  /api/v2/branch-users:
    post:
      tags:
      - Branch
      summary: Add user to branch
      description: '### Add a user to a branch


        Associates a user with a specific branch. To successfully add a user to a branch, provide the branch’s unique ID using the branch_id attribute and the user’s unique ID using the user_id attribute in the request body. If the request is valid and both the user and branch exist, the API creates the association and returns the corresponding branch-user relationship details.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                branch_id: <integer>
                user_id: <integer>
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
      - Branch
      summary: Remove user from branch
      description: '### Remove user from branch


        Removes a user from a specific branch. To successfully remove a user from a branch, provide the branch’s unique ID using the branch_id attribute and the user’s unique ID using the user_id attribute. If the request is valid and the association exists, the API deletes the branch-user relationship and returns a **204 No Content** response upon success.'
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
  /api/v2/branch-courses:
    post:
      tags:
      - Branch
      summary: Add course to branch
      description: '### Add course to branch


        Associates a course with a specific branch. To successfully assign a course to a branch, provide the course’s unique ID using the course_id attribute and the branch’s unique ID using the branch_id attribute in the request body. If the request is valid and both the course and branch exist, the API creates the association and returns the corresponding branch-course relationship details.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                branch_id: <integer>
                course_id: <integer>
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      - name: Content-Type
        in: header
        schema:
          type: string
        example: application/json
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
    delete:
      tags:
      - Branch
      summary: Remove course from branch
      description: '### Remove course from branch


        Removes a course from a specific branch. To successfully remove a course from a branch, provide the course''s unique ID using the `course_id` attribute and the branch''s unique ID using the `branch_id` attribute in the request body. If the request is valid and the association exists, the API deletes the branch-course relationship and returns a 204 No Content response upon success.'
      parameters:
      - name: X-API-Version
        in: header
        schema:
          type: string
        example: '{{apiVersion}}'
      responses:
        200:
          description: Successful response
          content:
            application/json: {}
  /api/v2/branches/{id}/status:
    put:
      tags:
      - Branch
      summary: Change branch status
      description: '### Change branch status. Activates or deactivates a specific branch. To update the branch status, include the branch''s unique ID as a path parameter in the request URL and provide a boolean value for the is_active attribute in the request body. If the request is valid and the branch exists, the API updates the branch''s status accordingly and returns the updated branch details.'
      operationId: updateBranchStatus
      parameters:
      - name: id
        in: path
        description: The ID of the branch
        required: true
        schema:
          type: integer
      - name: X-API-Version
        in: header
        required: false
        schema:
          type: string
        example: '{{apiVersion}}'
      - name: Content-Type
        in: header
        required: false
        schema:
          type: string
        example: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                is_active:
                  type: boolean
                  example: true
              type: object
      responses:
        204:
          description: Successful response
components:
  securitySchemes:
    apikeyAuth:
      type: apiKey
      in: header
      name: X-API-Key