MechaMental
Api reference

Branches

List Branches

GET
/v1/orgs/{org_id}/workspaces/{workspace_id}/apps/{app_id}/branches

Path Parameters

org_id*Org Id
workspace_id*Workspace Id
app_id*App Id

Query Parameters

search?|

Search by branch name

limit?Limit

Maximum number of items to return (1-200)

Default50
Range1 <= value <= 200
cursor?|

Cursor for pagination (from previous response's next_cursor)

Header Parameters

authorization?string|null

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://loading/v1/orgs/string/workspaces/string/apps/string/branches"
{
  "total": 0,
  "has_more": false,
  "next_cursor": "string",
  "branches": [
    {
      "branch_id": "string",
      "app_id": "string",
      "workspace_id": "string",
      "name": "string",
      "branch_type": "main",
      "status": "active",
      "is_protected": false,
      "owner_id": "string",
      "parent_branch_id": "string",
      "head_revision": "string",
      "changes_count": 0,
      "created_at": "string",
      "updated_at": "string",
      "is_behind_main": false,
      "commits_behind": 0
    }
  ],
  "main_branch_id": "string"
}
{
  "error": "AUTHENTICATION_FAILED",
  "message": "Authentication required",
  "details": {},
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 401
}
{
  "error": "FORBIDDEN",
  "message": "You don't have permission to perform this action",
  "details": {
    "required_permission": "resource:action"
  },
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 403
}
{
  "error": "RESOURCE_NOT_FOUND",
  "message": "The requested resource was not found",
  "details": {
    "resource_type": "example",
    "resource_id": "xxx"
  },
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 404
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
{
  "error": "INTERNAL_SERVER_ERROR",
  "message": "An unexpected error occurred",
  "details": {},
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 500
}

Get Branch

GET
/v1/orgs/{org_id}/workspaces/{workspace_id}/apps/{app_id}/branches/{branch_id}

Path Parameters

org_id*Org Id
workspace_id*Workspace Id
app_id*App Id
branch_id*Branch Id

Header Parameters

authorization?string|null

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://loading/v1/orgs/string/workspaces/string/apps/string/branches/string"
{
  "branch_id": "string",
  "app_id": "string",
  "workspace_id": "string",
  "name": "string",
  "branch_type": "main",
  "status": "active",
  "is_protected": false,
  "owner_id": "string",
  "parent_branch_id": "string",
  "head_revision": "string",
  "changes_count": 0,
  "created_at": "string",
  "updated_at": "string",
  "is_behind_main": false,
  "commits_behind": 0
}
{
  "error": "AUTHENTICATION_FAILED",
  "message": "Authentication required",
  "details": {},
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 401
}
{
  "error": "FORBIDDEN",
  "message": "You don't have permission to perform this action",
  "details": {
    "required_permission": "resource:action"
  },
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 403
}
{
  "error": "RESOURCE_NOT_FOUND",
  "message": "The requested resource was not found",
  "details": {
    "resource_type": "example",
    "resource_id": "xxx"
  },
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 404
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
{
  "error": "INTERNAL_SERVER_ERROR",
  "message": "An unexpected error occurred",
  "details": {},
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 500
}

Ensure Main Branch

POST
/v1/orgs/{org_id}/workspaces/{workspace_id}/apps/{app_id}/branches/main/ensure

Path Parameters

org_id*Org Id
workspace_id*Workspace Id
app_id*App Id

Header Parameters

authorization?string|null

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://loading/v1/orgs/string/workspaces/string/apps/string/branches/main/ensure"
{
  "branch_id": "string",
  "app_id": "string",
  "workspace_id": "string",
  "name": "string",
  "branch_type": "main",
  "status": "active",
  "is_protected": false,
  "owner_id": "string",
  "parent_branch_id": "string",
  "head_revision": "string",
  "changes_count": 0,
  "created_at": "string",
  "updated_at": "string",
  "is_behind_main": false,
  "commits_behind": 0
}
{
  "error": "AUTHENTICATION_FAILED",
  "message": "Authentication required",
  "details": {},
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 401
}
{
  "error": "FORBIDDEN",
  "message": "You don't have permission to perform this action",
  "details": {
    "required_permission": "resource:action"
  },
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 403
}
{
  "error": "RESOURCE_NOT_FOUND",
  "message": "The requested resource was not found",
  "details": {
    "resource_type": "example",
    "resource_id": "xxx"
  },
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 404
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
{
  "error": "INTERNAL_SERVER_ERROR",
  "message": "An unexpected error occurred",
  "details": {},
  "timestamp": "2025-01-01T00:00:00.000000",
  "status_code": 500
}