Skip to content

Obține profil

Obține detaliile utilizatorului.

Endpoint

http
GET /api/v1/user

Exemplu de cerere

sh
curl --location --request GET 'https://files.ro/api/v1/user' \
--header 'Authorization: Bearer {token}'

Răspuns

json
{
  "data": {
    "id": "user_123",
    "type": "user",
    "attributes": {
      "color": "#00BC7E",
      "avatar": "https://files.ro/storage/avatars/jane.png",
      "email": "jane@example.com",
      "role": "user",
      "two_factor_authentication": false,
      "two_factor_confirmed_at": null,
      "socialite_account": false,
      "storage": 123456789,
      "created_at": "01. Jan. 2024",
      "updated_at": "02. Jan. 2024"
    },
    "relationships": {
      "readNotifications": {
        "data": [
          {
            "data": {
              "id": "notif_123",
              "type": "Domain\\UploadRequest\\Notifications\\UploadRequestNotification",
              "attributes": {
                "category": "upload",
                "title": "File uploaded",
                "description": "Your file was uploaded.",
                "action": "view",
                "created_at": "01. Jan. 2024 10:00",
                "read_at": null
              }
            }
          }
        ]
      },
      "unreadNotifications": {
        "data": [
          {
            "data": {
              "id": "notif_123",
              "type": "Domain\\UploadRequest\\Notifications\\UploadRequestNotification",
              "attributes": {
                "category": "upload",
                "title": "File uploaded",
                "description": "Your file was uploaded.",
                "action": "view",
                "created_at": "01. Jan. 2024 10:00",
                "read_at": null
              }
            }
          }
        ]
      },
      "settings": {
        "data": {
          "id": "user_123",
          "type": "settings",
          "attributes": {
            "avatar": "https://files.ro/storage/avatars/jane.png",
            "name": "Jane Doe",
            "first_name": "Jane",
            "last_name": "Doe",
            "address": "Example St",
            "state": "State",
            "city": "City",
            "postal_code": "12345",
            "country": "RO",
            "phone_number": "+40 700 000 000",
            "timezone": "Europe/Bucharest",
            "language": "ro"
          }
        }
      },
      "favourites": [
        {
          "data": {
            "id": "folder_123",
            "type": "folder",
            "attributes": {
              "name": "Projects",
              "color": "#00BC7E",
              "emoji": null,
              "filesize": 12345678,
              "isTeamFolder": false,
              "items": 12,
              "trashed_items": 0,
              "created_at": "01. Jan. 2024",
              "updated_at": "02. Jan. 2024",
              "deleted_at": null
            },
            "relationships": {
              "shared": {
                "data": {
                  "id": "share_123",
                  "type": "shared",
                  "attributes": {
                    "permission": "editor",
                    "protected": false,
                    "item_id": "item_123",
                    "expire_in": 24,
                    "token": "share_token",
                    "link": "https://files.ro/share/share_token",
                    "type": "folder"
                  }
                }
              },
              "parent": {
                "data": {
                  "type": "folder",
                  "id": "folder_root",
                  "attributes": {
                    "name": "Root"
                  }
                }
              },
              "user": {
                "data": {
                  "type": "user",
                  "id": "user_123",
                  "attributes": {
                    "name": "Jane Doe",
                    "avatar": "https://files.ro/storage/avatars/jane.png",
                    "color": "#00BC7E"
                  }
                }
              }
            }
          }
        }
      ],
      "creditCards": {
        "data": [
          {
            "data": {
              "id": "cc_123",
              "type": "credit-card",
              "attributes": {
                "brand": "visa",
                "last4": "4242",
                "service": "stripe",
                "reference": "card_ref",
                "isExpired": false,
                "isBeforeExpiration": true,
                "expiration": "Jan 2026",
                "created_at": "01. Jan. 2024",
                "updated_at": "01. Jan. 2024"
              }
            }
          }
        ]
      },
      "subscription": {
        "data": {
          "id": "sub_123",
          "type": "subscription",
          "attributes": {
            "is_cancelled": false,
            "driver": "stripe",
            "name": "default",
            "status": "active",
            "trial_ends_at": null,
            "updated_at": "01. Jan. 2024",
            "created_at": "01. Jan. 2024",
            "renews_at": "29. Jan. 2024",
            "ends_at": null
          },
          "relationships": {
            "plan": {
              "data": {
                "id": "plan_123",
                "type": "plans",
                "attributes": {
                  "name": "Pro",
                  "status": "active",
                  "type": "metered",
                  "visible": true,
                  "currency": "USD",
                  "interval": "monthly",
                  "description": "Pro plan",
                  "subscribers": 12,
                  "features": {
                    "storage": {
                      "aggregate_strategy": "sum",
                      "tiers": [
                        {
                          "up_to": 1000,
                          "unit_amount": 100
                        }
                      ]
                    }
                  },
                  "created_at": "01. Jan. 2024",
                  "updated_at": "01. Jan. 2024"
                },
                "meta": {
                  "driver_plan_id": {
                    "stripe": "plan_abc"
                  }
                }
              }
            },
            "user": {
              "data": {
                "id": "user_123",
                "type": "users",
                "attributes": {
                  "avatar": "https://files.ro/storage/avatars/jane.png",
                  "name": "Jane Doe",
                  "first_name": "Jane",
                  "last_name": "Doe",
                  "color": "#00BC7E",
                  "email": "jane@example.com"
                }
              }
            }
          }
        }
      },
      "balance": {
        "data": {
          "id": "bal_123",
          "type": "balance",
          "attributes": {
            "formatted": "$10.00",
            "balance": 10,
            "currency": "USD"
          }
        }
      },
      "alert": {
        "data": {
          "id": "alert_123",
          "type": "balance",
          "attributes": {
            "formatted": "$20.00",
            "amount": 20
          }
        }
      },
      "failedPayments": {
        "data": [
          {
            "data": {
              "id": "fail_123",
              "type": "failed-payment",
              "attributes": {
                "amount": "$5.00",
                "currency": "USD",
                "attempts": 1,
                "source": "stripe",
                "note": "Payment failed",
                "created_at": "01. Jan. 2024",
                "updated_at": "01. Jan. 2024"
              }
            }
          }
        ]
      }
    },
    "meta": {
      "restrictions": {
        "canUpload": true,
        "canDownload": true,
        "canCreateFolder": true,
        "canCreateTeamFolder": true,
        "canInviteTeamMembers": true,
        "reason": null
      },
      "limitations": {
        "max_storage_amount": {
          "use": "2.5 GB",
          "total": "10 GB",
          "percentage": 25
        },
        "max_team_members": {
          "use": 2,
          "total": 10,
          "percentage": 20,
          "meta": {
            "allowed_emails": [
              "member@example.com"
            ]
          }
        }
      },
      "usages": {
        "costEstimate": "$1.20",
        "featureEstimates": [
          {
            "key": "storage",
            "amount": 1.2,
            "formatted": "$1.20"
          }
        ]
      },
      "totalDebt": {
        "formatted": "$0.00",
        "amount": 0
      }
    }
  }
}
json
{
  "type": "error",
  "message": "You are not authorized"
}
json
{
  "message": "The given data was invalid.",
  "errors": {
    "field": [
      "The field is required."
    ]
  }
}