ورود | ثبت نام
  • FA
  • EN

API Docs

PUT /api/v1/gyms/{gym-id}

Updates the information of a specific gym by its ID. All parameters are optional; only provided fields will be updated. You can set fields to null to clear them.


Permissions

PermissionDescription
gyms.updateUpdate your own gym
gyms.update_anyUpdate any gym as an admin
gyms.transfer_ownershipTransfer gym ownership (for user_id field)
gyms.approve_licenseApprove or reject the gym license (for gym_license_approved / gym_license_rejection_reason)

Path Parameters

NameTypeRequiredDescriptionExample
gym-idintYesID of the gym to update123

Request Body Parameters

NameTypeRequiredDescriptionExample
namestringNoName of the gym (max 255 characters)"Iron Paradise"
addressstringNoAddress of the gym (max 255 characters)"123 Main St"
location_latfloatNoLatitude coordinate of the gym35.6892
location_lngfloatNoLongitude coordinate of the gym51.3890
is_activeboolNoWhether the gym is activetrue
show_crowdboolNoWhether to display crowd informationfalse
descriptionstringNoDescription of the gym (max 2000 characters)"Best gym..."
user_idintNoUser ID to assign the gym to (requires gyms.transfer_ownership permission)42
city_idintNoID of the city where the gym is located5
major_idsstringNoComma-separated list of major IDs. Use 0 to detach all majors."1,2,3"
gym_license_imagenullNoOnly null is accepted, which clears the license document and resets its approval to pending. To upload a license, use POST /api/v1/media with purpose=gym_license. Any non-null value is a validation error.null
gym_license_approvedboolNoReview outcome: true approved, false rejected, null pending. Requires gyms.approve_license.true
gym_license_rejection_reasonstringNoWhy the license was rejected (max 2000 characters). Requires gyms.approve_license."Document expired."

License review. gym_license_approved and gym_license_rejection_reason may only be sent by a user with gyms.approve_license; anyone else gets 403. Setting gym_license_approved to true or false (a change from its previous value) notifies the gym owner. Clearing gym_license_image deletes the stored document and resets both review fields to null.


Request Example

{
  "name": "Iron Paradise",
  "address": "123 Main St",
  "location_lat": 35.6892,
  "location_lng": 51.3890,
  "is_active": true,
  "show_crowd": false,
  "description": "A premium gym with modern equipment.",
  "user_id": 42,
  "city_id": 5,
  "major_ids": "1,2,3"
}

Response

200 OK

Returns the updated gym resource.

Schema

{
  "gym": { /* Gym Resource */ }
}

Example

{
  "gym": {
    "id": 123,
    "name": "Iron Paradise",
    "address": "123 Main St",
    "location_lat": 35.6892,
    "location_lng": 51.3890,
    "is_active": true,
    "description": "A premium gym with modern equipment.",
    "created_at": "2023-01-01 10:00:00",
    "updated_at": "2023-01-01 10:10:00",
    "show_crowd": false,
    "crowd": null,
    "city": {
      "id": 5,
      "name": "Tehran",
      "state": { "id": 1, "name": "Tehran Province" }
    },
    "majors": [
      { "id": 1, "title": "Bodybuilding" },
      { "id": 2, "title": "Crossfit" }
    ],
    "working_periods": [],
    "working_status": null,
    "boost": null,
    "media": [],
    "rating_count": 0,
    "rating_average": 0
  }
}

For a full schema, see Gym Resource.


Error Responses

StatusDescriptionReference
422Validation errorValidation error
401UnauthorizedAuthentication error
403Forbidden (no permission, including reviewing a license without gyms.approve_license)Permission error
Dambel

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutubeTelegramGitHub