GROperator

جارٍ التحميل…

English

Auth

كل عمليات واجهة LastMile العامة، مولَّدة من وثيقة OpenAPI. نص المرجع بالإنجليزية في اللغتين.

POST

/api/public/v1/auth/login

#

Sign in with username and password

لا يلزم اعتماد

Returns a bearer token pair. Failed attempts count toward the same lockout and per-network/device throttling as the dashboard sign-in (HTTP 401 auth.invalid_credentials, then 429 auth.login_temporarily_blocked). The company must have the public API enabled, otherwise 403 channel_disabled and no token is issued. Rate limit policy: 30 requests per minute per IP.

جسم الطلب · PublicLoginRequestapplication/json

The credentials.

الحقلالنوعالوصف
usernamestringيقبل null

Username or e-mail address.

passwordstringيقبل null

Password.

وثيقة OpenAPI لا تعلّم الحقول المطلوبة رسمياً، لذلك تُقرأ كلمة «مطلوب» من وصف كل حقل. تسرد الأدلة الحقول المطلوبة لكل طلب.

مثال طلب

POST /auth/login
curl -X POST "https://api.goldrock.live/api/public/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
  "username": "ahmed@your-company.example",
  "password": "YOUR_PASSWORD"
}'

تستخدم الأمثلة مفتاح API؛ استبدل القيم النائبة. لاستخدام رمز Bearer أرسل Authorization: Bearer <accessToken>.

الاستجابات

200Signed in.

الاستجابات · الحقل
الحقلالنوعالوصف
accessTokenstringيقبل null

JWT to send as Authorization: Bearer ....

refreshTokenstringيقبل null

Single-use refresh token.

tokenTypestringيقبل null

Always Bearer.

expiresIninteger (int32)

Lifetime of the access token in seconds.

200 · مثال استجابة
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "q3kZ0m8w...",
  "tokenType": "Bearer",
  "expiresIn": 900
}
الحالةالوصف
400

The request is invalid (code validation_failed, details.errors lists every field).

401

Wrong username or password.

403

Public API disabled for the company, company suspended, or account inactive.

422

A business rule or a location could not be satisfied (codes such as geo_city_not_found, shipment.cannot_cancel).

429

Too many attempts.

تشترك أخطاء الواجهة في جسم واحد موصوف في مرجع الأخطاء. مرجع الأخطاء

GET

/api/public/v1/auth/me

#

Describe the current caller: company, user or API key, scopes and permissions

مفتاح API وسرّه، أو رمز Bearerأي اعتماد صالح

Requires authentication (bearer token, or X-API-Key with X-API-Secret). No scope is needed.

مثال طلب

GET /auth/me
curl "https://api.goldrock.live/api/public/v1/auth/me" \
  -H "X-API-Key: lmc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "X-API-Secret: YOUR_API_SECRET"

تستخدم الأمثلة مفتاح API؛ استبدل القيم النائبة. لاستخدام رمز Bearer أرسل Authorization: Bearer <accessToken>.

الاستجابات

200The caller.

الاستجابات · الحقل
الحقلالنوعالوصف
authMethodstringيقبل null

password or api_key.

companyPublicCompanyDto

Company identity shown by the public auth/me endpoint.

id
company.id
string (uuid)

Company id.

name
company.name
stringيقبل null

Company name.

slug
company.slug
stringيقبل null

Company slug.

userPublicUserDto

The user behind a password-authenticated call.

id
user.id
string (uuid)

User id.

name
user.name
stringيقبل null

Full name.

apiKeyPublicApiKeyDto

The API key behind a key-authenticated call.

id
apiKey.id
string (uuid)

API key id.

name
apiKey.name
stringيقبل null

Label given to the key.

scopesarray<string>يقبل null

API scopes granted (for password callers: the scopes the user's permissions cover).

permissionsarray<string>يقبل null

Permission codes held by the caller.

200 · مثال استجابة
{
  "authMethod": "api_key",
  "company": {
    "id": "0f8fad5b-d9cb-469f-a165-70867728950e",
    "name": "Fast Express",
    "slug": "fast-express"
  },
  "user": null,
  "apiKey": {
    "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "name": "Website integration"
  },
  "scopes": [
    "geography:read",
    "pricing:read",
    "shipments:read",
    "shipments:write"
  ],
  "permissions": [
    "orders:create",
    "orders:read"
  ]
}
الحالةالوصف
401

Not authenticated.

403

Public API disabled for the company.

429

Too many requests (code rate_limited); wait for the Retry-After header.

تشترك أخطاء الواجهة في جسم واحد موصوف في مرجع الأخطاء. مرجع الأخطاء

POST

/api/public/v1/auth/refresh

#

Exchange a refresh token for a new token pair

لا يلزم اعتماد

The refresh token is single use: store the new one returned here. Rate limit: 10 requests per minute per IP.

جسم الطلب · PublicRefreshRequestapplication/json

The refresh token.

الحقلالنوعالوصف
refreshTokenstringيقبل null

The refresh token returned by login or by a previous refresh (single use).

وثيقة OpenAPI لا تعلّم الحقول المطلوبة رسمياً، لذلك تُقرأ كلمة «مطلوب» من وصف كل حقل. تسرد الأدلة الحقول المطلوبة لكل طلب.

مثال طلب

POST /auth/refresh
curl -X POST "https://api.goldrock.live/api/public/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{
  "refreshToken": "YOUR_REFRESH_TOKEN"
}'

تستخدم الأمثلة مفتاح API؛ استبدل القيم النائبة. لاستخدام رمز Bearer أرسل Authorization: Bearer <accessToken>.

الاستجابات

200New token pair.

الاستجابات · الحقل
الحقلالنوعالوصف
accessTokenstringيقبل null

JWT to send as Authorization: Bearer ....

refreshTokenstringيقبل null

Single-use refresh token.

tokenTypestringيقبل null

Always Bearer.

expiresIninteger (int32)

Lifetime of the access token in seconds.

200 · مثال استجابة
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "q3kZ0m8w...",
  "tokenType": "Bearer",
  "expiresIn": 900
}
الحالةالوصف
400

The request is invalid (code validation_failed, details.errors lists every field).

401

The refresh token is invalid or expired.

403

Public API disabled for the company.

422

A business rule or a location could not be satisfied (codes such as geo_city_not_found, shipment.cannot_cancel).

429

Too many requests (code rate_limited); wait for the Retry-After header.

تشترك أخطاء الواجهة في جسم واحد موصوف في مرجع الأخطاء. مرجع الأخطاء