Skip to main content

Business

On-demand

Your workout studios, recipe books and resource collections, and which clients can open them.

What a coach puts up for clients to use any time, in three kinds that work alike, each up to 100 per workspace. Workout studios hold workouts, recipe books hold recipes, and resource collections hold resources. A client sees one in their app once you grant them access.

Attributes

  • idstring

    Its unique ID.

  • namestring
Workout studio object
{
  "id": "6ad6af358bfd50368bfee337",
  "name": "Home workouts"
}

Attributes

  • idstring

    Its unique ID.

  • namestring
Recipe book object
{
  "id": "6ad6af48098ec0490990534a",
  "name": "High-protein meals"
}

Attributes

  • idstring

    Its unique ID.

  • namestring
Resource collection object
{
  "id": "6ad6af06142ae30514295008",
  "name": "Getting started"
}
GET/v1/workout-studios

Every workout studio in the workspace, newest first, to pass one's id when granting a client access. A workspace has no more than 100, so they all come in one response, without paging. Requires on-demand:write.

This endpoint takes no parameters.

Returns

Every workout studio in the workspace.

GET /v1/workout-studios
curl https://api.hubfit.com/v1/workout-studios \
  -H "Authorization: Bearer $HUBFIT_API_KEY"
Response200 OK
{
  "data": [
    {
      "id": "6ad6af358bfd50368bfee337",
      "name": "Home workouts"
    }
  ]
}
POST/v1/clients/{clientId}/workout-studios

Grants the client access to the workout studio, as adding them under Manage Access in the app does: it shows in their app and they get a notification. Workout Studio appears in their app if it wasn't there. If they already have access, nothing changes and nothing is sent: that's a 200 instead of a 201, so a retry is safe. Requires on-demand:write.

Headers

  • Any unique string, such as a UUID, up to 255 characters. Retrying with the same key within 24 hours returns the first response instead of repeating the write. See Idempotency.

Path parameters

Body parameters

Returns

200: The client already had access, so nothing changed. 201: Access granted.

POST /v1/clients/{clientId}/workout-studios
curl -X POST https://api.hubfit.com/v1/clients/6ad6af41d3199442d31b2743/workout-studios \
  -H "Authorization: Bearer $HUBFIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "workoutStudioId": "6ad6af358bfd50368bfee337"
  }'
Response201 Created
{
  "data": {
    "id": "6ad6af358bfd50368bfee337",
    "name": "Home workouts"
  }
}
DELETE/v1/clients/{clientId}/workout-studios/{workoutStudioId}

Revokes the client's access to the workout studio, as removing them under Manage Access in the app does. It disappears from their app, and Workout Studio with it once they have no workout studios left. If they didn't have access, nothing changes. Requires on-demand:write.

Path parameters

Returns

The client no longer has access.

DELETE /v1/clients/{clientId}/workout-studios/{workoutStudioId}
curl -X DELETE https://api.hubfit.com/v1/clients/6ad6af41d3199442d31b2743/workout-studios/6ad6af358bfd50368bfee337 \
  -H "Authorization: Bearer $HUBFIT_API_KEY"
Response200 OK
{
  "data": {
    "id": "6ad6af165d04c7155d033418",
    "revoked": true
  }
}

List recipe books

GET/v1/recipe-books

Every recipe book in the workspace, newest first, to pass one's id when granting a client access. A workspace has no more than 100, so they all come in one response, without paging. Requires on-demand:write.

This endpoint takes no parameters.

Returns

Every recipe book in the workspace.

GET /v1/recipe-books
curl https://api.hubfit.com/v1/recipe-books \
  -H "Authorization: Bearer $HUBFIT_API_KEY"
Response200 OK
{
  "data": [
    {
      "id": "6ad6af48098ec0490990534a",
      "name": "High-protein meals"
    }
  ]
}
POST/v1/clients/{clientId}/recipe-books

Grants the client access to the recipe book, as adding them under Manage Access in the app does: it shows in their app and they get a notification. Recipe Books appears in their app if it wasn't there. If they already have access, nothing changes and nothing is sent: that's a 200 instead of a 201, so a retry is safe. Requires on-demand:write.

Headers

  • Any unique string, such as a UUID, up to 255 characters. Retrying with the same key within 24 hours returns the first response instead of repeating the write. See Idempotency.

Path parameters

Body parameters

Returns

200: The client already had access, so nothing changed. 201: Access granted.

POST /v1/clients/{clientId}/recipe-books
curl -X POST https://api.hubfit.com/v1/clients/6ad6af41d3199442d31b2743/recipe-books \
  -H "Authorization: Bearer $HUBFIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "recipeBookId": "6ad6af48098ec0490990534a"
  }'
Response201 Created
{
  "data": {
    "id": "6ad6af48098ec0490990534a",
    "name": "High-protein meals"
  }
}
DELETE/v1/clients/{clientId}/recipe-books/{recipeBookId}

Revokes the client's access to the recipe book, as removing them under Manage Access in the app does. It disappears from their app, and Recipe Books with it once they have no recipe books left. If they didn't have access, nothing changes. Requires on-demand:write.

Path parameters

  • clientIdstringRequired

    The client's id.

  • recipeBookIdstringRequired

    A recipe book id from GET /recipe-books.

Returns

The client no longer has access.

DELETE /v1/clients/{clientId}/recipe-books/{recipeBookId}
curl -X DELETE https://api.hubfit.com/v1/clients/6ad6af41d3199442d31b2743/recipe-books/6ad6af48098ec0490990534a \
  -H "Authorization: Bearer $HUBFIT_API_KEY"
Response200 OK
{
  "data": {
    "id": "6ad6af165d04c7155d033418",
    "revoked": true
  }
}
GET/v1/resource-collections

Every resource collection in the workspace, newest first, to pass one's id when granting a client access. A workspace has no more than 100, so they all come in one response, without paging. Requires on-demand:write.

This endpoint takes no parameters.

Returns

Every resource collection in the workspace.

GET /v1/resource-collections
curl https://api.hubfit.com/v1/resource-collections \
  -H "Authorization: Bearer $HUBFIT_API_KEY"
Response200 OK
{
  "data": [
    {
      "id": "6ad6af06142ae30514295008",
      "name": "Getting started"
    }
  ]
}
POST/v1/clients/{clientId}/resource-collections

Grants the client access to the resource collection, as adding them under Manage Access in the app does: it shows in their app and they get a notification. If they already have access, nothing changes and nothing is sent: that's a 200 instead of a 201, so a retry is safe. Requires on-demand:write.

Headers

  • Any unique string, such as a UUID, up to 255 characters. Retrying with the same key within 24 hours returns the first response instead of repeating the write. See Idempotency.

Path parameters

Body parameters

Returns

200: The client already had access, so nothing changed. 201: Access granted.

POST /v1/clients/{clientId}/resource-collections
curl -X POST https://api.hubfit.com/v1/clients/6ad6af41d3199442d31b2743/resource-collections \
  -H "Authorization: Bearer $HUBFIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceCollectionId": "6ad6af06142ae30514295008"
  }'
Response201 Created
{
  "data": {
    "id": "6ad6af06142ae30514295008",
    "name": "Getting started"
  }
}
DELETE/v1/clients/{clientId}/resource-collections/{resourceCollectionId}

Revokes the client's access to the resource collection, as removing them under Manage Access in the app does. It disappears from their app. If they didn't have access, nothing changes. Requires on-demand:write.

Path parameters

Returns

The client no longer has access.

DELETE /v1/clients/{clientId}/resource-collections/{resourceCollectionId}
curl -X DELETE https://api.hubfit.com/v1/clients/6ad6af41d3199442d31b2743/resource-collections/6ad6af06142ae30514295008 \
  -H "Authorization: Bearer $HUBFIT_API_KEY"
Response200 OK
{
  "data": {
    "id": "6ad6af165d04c7155d033418",
    "revoked": true
  }
}