OpenAPI / Swagger
مستندات API
مستندات نسخهدار API برای احراز هویت، کیف پول، کلید API و سرویسهای عمومی.
سرویسهای فعال
اعتبارسنجی JSON
POST https://apiserv.ir/api/v1/json/validate
0 تومان
تولید نمونه سوال
POST https://apiserv.ir/api/v1/ai/quiz
500 تومان
خلاصهساز متن
POST https://apiserv.ir/api/v1/ai/summary
500 تومان
نامه اداری هوشمند
POST https://apiserv.ir/api/v1/ai/letter
500 تومان
استعلام مشخصات کارت بانکی - تبدیل کارت به شبا
POST https://apiserv.ir/api/v1/bank/card-full
1,000 تومان
استعلام شبا با شماره حساب
POST https://apiserv.ir/api/v1/bank/account-to-iban
1,000 تومان
استعلام نام دارنده شبا
POST https://apiserv.ir/api/v1/bank/iban-info
800 تومان
تطبیق کد ملی با شبا
POST https://apiserv.ir/api/v1/bank/national-id-iban-match
1,800 تومان
تطبیق کد ملی با کارت
POST https://apiserv.ir/api/v1/bank/national-id-card-match
2,500 تومان
صحتسنجی کارت بانکی
POST https://apiserv.ir/api/v1/verify/bank-card-validate
100 تومان
قیمت لحظهای ارز و فلزات
GET https://apiserv.ir/api/v1/api/v1/market/summary
0 تومان
استعلام اینماد
POST https://apiserv.ir/api/v1/verify/enamad
3,500 تومان
صحتسنجی کد ملی
POST https://apiserv.ir/api/v1/verify/national-id-validate
0 تومان
اعتبارسنجی ایمیل
POST https://apiserv.ir/api/v1/verify/email-validate
0 تومان
چت هوش مصنوعی
POST https://apiserv.ir/api/v1/ai/chat
60 تومان
ویرایش تصویر با هوش مصنوعی
POST https://apiserv.ir/api/v1/api/v1/ai/image-edit
120 تومان
تبدیل صدا به متن
POST https://apiserv.ir/api/v1/api/v1/ai/speech-to-text
120 تومان
تبدیل متن به صدا
POST https://apiserv.ir/api/v1/api/v1/ai/tts
597 تومان
تبدیل عکس به متن
POST https://apiserv.ir/api/v1/api/v1/ai/image-to-text
120 تومان
آب و هوا
POST https://apiserv.ir/api/v1/weather
50 تومان
تولید کد QR
POST https://apiserv.ir/api/v1/qr
0 تومان
تولید هش متن
POST https://apiserv.ir/api/v1/hash
0 تومان
تبدیل متن به Base64
POST https://apiserv.ir/api/v1/base64/encode
0 تومان
تبدیل Base64 به متن
POST https://apiserv.ir/api/v1/base64/decode
0 تومان
فرمتبندی JSON
POST https://apiserv.ir/api/v1/json/format
0 تومان
کمحجمسازی JSON
POST https://apiserv.ir/api/v1/json/minify
0 تومان
ژئوکدینگ معکوس (موقعیت به آدرس)
POST https://apiserv.ir/api/v1/map/reverse-geocode
50 تومان
ژئوکدینگ (آدرس به موقعیت)
POST https://apiserv.ir/api/v1/map/geocode
50 تومان
جستجوی مکانهای نزدیک
POST https://apiserv.ir/api/v1/map/nearby
80 تومان
جستجوی مکان
POST https://apiserv.ir/api/v1/map/search
80 تومان
ترجمه متن
POST https://apiserv.ir/api/v1/translate
0 تومان
استعلام اطلاعات آیپی
POST https://apiserv.ir/api/v1/iplookup
0 تومان
اطلاعات کشور
POST https://apiserv.ir/api/v1/country
0 تومان
مشخصات OpenAPI
فایل کامل: docs/openapi.yaml
openapi: 3.0.3
info:
title: APISERV API
version: 1.0.0
description: |
Versioned API marketplace and gateway.
All responses use a standard envelope:
`success`, `data`, `error`, `request_id`.
servers:
- url: https://apiserv.ir/api/v1
- url: http://localhost:90/apiserv/public/api/v1
tags:
- name: Auth
- name: User
- name: API Keys
- name: Payments
- name: Tickets
- name: Gateway
- name: Admin
paths:
/health:
get:
tags: [Gateway]
summary: Health check
responses:
'200':
description: Service is healthy
/auth/request-otp:
post:
tags: [Auth]
summary: Request SMS OTP for a mobile
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [mobile]
properties:
mobile: {type: string, example: '09158123576'}
responses:
'200': {description: OTP sent}
'422': {description: Validation error}
'429': {description: OTP rate limited or cooldown}
/auth/verify-otp:
post:
tags: [Auth]
summary: Verify OTP and receive a Bearer token
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [mobile, code]
properties:
mobile: {type: string}
code: {type: string, minLength: 6, maxLength: 6}
name: {type: string, nullable: true}
responses:
'200': {description: Authenticated}
'422': {description: Invalid or expired OTP}
/auth/login:
post:
tags: [Auth]
summary: Login with mobile and password
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [mobile, password]
properties:
mobile: {type: string, example: '09158123576'}
password: {type: string, format: password, example: '123456'}
responses:
'200': {description: Authenticated}
'401': {description: Invalid credentials}
'429': {description: Login rate limited}
/auth/logout:
post:
tags: [Auth]
summary: Revoke current Bearer token
security: [{BearerAuth: []}]
responses:
'200': {description: Logged out}
/user/dashboard:
get:
tags: [User]
summary: Customer dashboard summary
security: [{BearerAuth: []}]
responses:
'200': {description: Dashboard payload}
/user/transactions:
get:
tags: [User]
summary: Wallet transactions
security: [{BearerAuth: []}]
responses:
'200': {description: Transaction list}
/api-keys:
get:
tags: [API Keys]
summary: List API keys
security: [{BearerAuth: []}]
responses:
'200': {description: Key list}
post:
tags: [API Keys]
summary: Create API key (raw key returned once)
security: [{BearerAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: {type: string, example: production}
responses:
'201': {description: Key created}
/api-keys/{apiKey}:
delete:
tags: [API Keys]
summary: Revoke API key
security: [{BearerAuth: []}]
parameters:
- {name: apiKey, in: path, required: true, schema: {type: integer}}
responses:
'200': {description: Revoked}
'404': {description: Not found}
/payments:
post:
tags: [Payments]
summary: Create wallet charge payment
security: [{BearerAuth: []}]
parameters:
- {name: Idempotency-Key, in: header, schema: {type: string}}
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [amount]
properties:
amount: {type: integer, minimum: 1000, example: 10000}
responses:
'201': {description: Payment created}
/payments/{payment}/verify:
post:
tags: [Payments]
summary: Verify pending payment (idempotent; credits wallet once)
security: [{BearerAuth: []}]
parameters:
- {name: payment, in: path, required: true, schema: {type: integer}}
responses:
'200': {description: Verified or already verified}
/tickets:
get:
tags: [Tickets]
summary: List current user's tickets
security: [{BearerAuth: []}]
responses:
'200': {description: Ticket list}
post:
tags: [Tickets]
summary: Create a support ticket
security: [{BearerAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [subject, message]
properties:
subject: {type: string}
message: {type: string}
responses:
'201': {description: Ticket created}
/tickets/{ticket}/reply:
post:
tags: [Tickets]
summary: Reply to a ticket
security: [{BearerAuth: []}]
parameters:
- {name: ticket, in: path, required: true, schema: {type: integer}}
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [message]
properties:
message: {type: string}
responses:
'200': {description: Reply stored}
/translate:
post:
tags: [Gateway]
summary: Text translation service (API key bearer)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [text, target_language]
properties:
text: {type: string}
target_language: {type: string, minLength: 2, maxLength: 2, example: en}
responses:
'200': {description: Translation result}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
/map/geocode:
post:
tags: [Gateway]
summary: Convert Persian address text to coordinates (Geocoding)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [address]
properties:
address: {type: string, minLength: 3, maxLength: 500}
province: {type: string, maxLength: 100}
city: {type: string, maxLength: 100}
latitude: {type: number, minimum: -90, maximum: 90}
longitude: {type: number, minimum: -180, maximum: 180}
responses:
'200': {description: Geocoding items}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/map/reverse-geocode:
post:
tags: [Gateway]
summary: Convert coordinates to address (Reverse Geocoding)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [latitude, longitude]
properties:
latitude: {type: number, minimum: -90, maximum: 90}
longitude: {type: number, minimum: -180, maximum: 180}
responses:
'200': {description: Address result}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
/map/search:
post:
tags: [Gateway]
summary: Search places relative to a center point (Place search)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [term, latitude, longitude]
properties:
term: {type: string, minLength: 2, maxLength: 200}
latitude: {type: number, minimum: -90, maximum: 90}
longitude: {type: number, minimum: -180, maximum: 180}
responses:
'200': {description: Search results}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
/map/nearby:
post:
tags: [Gateway]
summary: Nearby places by category (Nearby search)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [latitude, longitude, layer, search_radius]
properties:
latitude: {type: number, minimum: -90, maximum: 90}
longitude: {type: number, minimum: -180, maximum: 180}
layer: {type: string, example: park}
search_radius: {type: integer, minimum: 50, maximum: 20000, example: 1200}
responses:
'200': {description: Nearby places}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
/iplookup:
post:
tags: [Gateway]
summary: IP geolocation lookup (IPv4/IPv6)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [ip]
properties:
ip: {type: string, example: 8.8.8.8}
responses:
'200': {description: IP details (country, city, timezone, ASN)}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/country:
post:
tags: [Gateway]
summary: Country details by ISO 3166-1 alpha-2 code
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [slug]
properties:
slug: {type: string, minLength: 2, maxLength: 2, example: IR}
responses:
'200': {description: Country details (name, capital, currency, languages)}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/qr:
post:
tags: [Gateway]
summary: Generate a QR code image (PNG data URI or SVG)
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [text]
properties:
text: {type: string, minLength: 1, maxLength: 2000, example: 'https://example.com'}
type: {type: string, enum: [png, svg], nullable: true, default: png}
resolution: {type: integer, minimum: 64, maximum: 1024, nullable: true, example: 300}
responses:
'200': {description: Generated QR code}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/hash:
post:
tags: [Gateway]
summary: Calculate a hash digest of text
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [text, algorithm]
properties:
text: {type: string, maxLength: 10000}
algorithm: {type: string, enum: [md5, sha1, sha224, sha256, sha384, sha512, sha3-224, sha3-256, sha3-384, sha3-512, ripemd160, whirlpool]}
responses:
'200': {description: Hash value}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/base64/encode:
post:
tags: [Gateway]
summary: Encode text to Base64
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [text]
properties:
text: {type: string, maxLength: 100000}
responses:
'200': {description: Encoded string}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/base64/decode:
post:
tags: [Gateway]
summary: Decode a Base64 string back to text
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [text]
properties:
text: {type: string, maxLength: 100000, example: 'aGVsbG8='}
responses:
'200': {description: Decoded text}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error or invalid Base64 input}
/json/validate:
post:
tags: [Gateway]
summary: Validate JSON structure without failing on invalid input
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [json_text]
properties:
json_text: {type: string, maxLength: 100000, example: '{"name":"apiserv"}'}
responses:
'200': {description: Validation result (valid/error)}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/json/format:
post:
tags: [Gateway]
summary: Pretty-print JSON with indentation
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [json_text]
properties:
json_text: {type: string, maxLength: 100000}
responses:
'200': {description: Formatted JSON}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error or invalid JSON input}
/json/minify:
post:
tags: [Gateway]
summary: Minify JSON by removing whitespace
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [json_text]
properties:
json_text: {type: string, maxLength: 100000}
responses:
'200': {description: Minified JSON}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error or invalid JSON input}
/weather:
post:
tags: [Gateway]
summary: Current weather by coordinates
security: [{ApiKeyBearer: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [lat, lng]
properties:
lat: {type: number, minimum: -90, maximum: 90, example: 35.6892}
lng: {type: number, minimum: -180, maximum: 180, example: 51.389}
responses:
'200': {description: Weather snapshot (temperature, humidity, wind, description)}
'401': {description: Invalid API key}
'402': {description: Insufficient credit}
'429': {description: Rate limit exceeded}
'502': {description: Provider error}
/admin/dashboard:
get:
tags: [Admin]
summary: Admin dashboard stats
security: [{BearerAuth: []}]
responses:
'200': {description: Stats}
'403': {description: Missing permission}
/admin/users:
get:
tags: [Admin]
summary: List system users
security: [{BearerAuth: []}]
responses:
'200': {description: User list}
/admin/users/{user}/status:
patch:
tags: [Admin]
summary: Change user status
security: [{BearerAuth: []}]
parameters:
- {name: user, in: path, required: true, schema: {type: integer}}
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [status]
properties:
status: {type: string, enum: [active, blocked, suspended, inactive]}
responses:
'200': {description: Updated}
components:
securitySchemes:
BearerAuth: {type: http, scheme: bearer, description: Sanctum personal access token}
ApiKeyBearer:
type: http
scheme: bearer
description: Full API key (`aps_...`) as the Bearer token.
schemas:
Success:
type: object
properties:
success: {type: boolean, example: true}
data: {type: object, nullable: true}
error: {type: object, nullable: true}
request_id: {type: string}
Error:
type: object
properties:
success: {type: boolean, example: false}
data: {type: object, nullable: true}
error:
type: object
properties:
code: {type: string, example: INSUFFICIENT_BALANCE}
message: {type: string}
request_id: {type: string}
security:
- BearerAuth: []
نمونه درخواست
curl -X POST https://apiserv.ir/api/v1/translate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"سلام","target_language":"en"}'
کدهای خطای رایج
INVALID_API_KEY— کلید نامعتبر یا لغوشدهRATE_LIMIT_EXCEEDED— اشباع محدودیت نرخ درخواستINSUFFICIENT_CREDIT— موجودی/سقف اعتبار کافی نیستSERVICE_NOT_FOUND— سرویس موجود یا فعال نیستPROVIDER_ERROR— خطای ارائهدهنده پشتیبان