Retrieve an injectable
This endpoint fetches one injectable under a project. Injectables always return encrypted payloads for sensitive fields, plus integrity fields you can use to verify that what you decrypted is exactly what you originally uploaded/sent.
Endpoint
GET /v1/project/{project}/injectables/{injectable}
Authentication
This endpoint uses your API Key.
Required header
X-API-KEY: <your_api_key>
Path Parameters
project
integer
β
The project ID
injectable
integer
β
The injectable ID
Headers
X-API-KEY
β
Your API key
Accept
recommended
Use application/json
Request Example (cURL)
curl -X GET "https://api.devpayr.com/v1/project/2/injectables/3" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"{
"status": "success",
"message": "Success",
"data": {
"id": 3,
"project_id": 2,
"slug": "client-bundle-1",
"title": "Client Bundle",
"type": "snippet",
"mode": "inject",
"target_path": "resources/js/checkout.js",
"content": "ENCRYPTED_STRING",
"file_path": null,
"content_hash": "SHA256_HASH_HEX",
"signature": "HMAC_SHA256_HEX",
"validate_endpoint": "https://yourapp.com/sdk-check",
"only_if_paid": true,
"is_active": true,
"meta": {},
"last_delivered_at": null,
"created_at": "2025-12-13T12:57:24.000000Z",
"updated_at": "2025-12-13T12:57:24.000000Z"
},
"errors": null
}Response Fields Explained
Top-level response keys
status
string
"success" or "error" depending on outcome
message
string
Human-readable summary message
data
object | null
The returned resource (injectable) on success
errors
object | null
Error details (if any)
data (Injectable) keys
data (Injectable) keysid
integer
β
Injectable ID
project_id
integer
β
Project the injectable belongs to
slug
string
β
Unique identifier (per project) used for referencing
title
string | null
β
Friendly name
type
string
β
Injectable type (e.g. file, snippet, html, script, etc.)
mode
string
β
How the injectable should be applied (e.g. write, inject, etc.)
target_path
string
β
Where it should be applied in the client project (path or destination)
content
string
β
Encrypted content payload (decrypt using your secret)
file_path
string | null
β
For type="file": Encrypted file reference/path. Otherwise null.
content_hash
string
β
SHA-256 hash (hex) of the plain decrypted content for verification
signature
string
β
HMAC-SHA256 signature (hex) of plain decrypted content, using your secret
validate_endpoint
string | null
β
Optional URL you can call to validate before applying
only_if_paid
boolean
β
If true, apply this injectable only when payment status is satisfied
is_active
boolean
β
If false, injectable should be treated as disabled
meta
object
β
Extra metadata (non-sensitive). Treat as optional/implementation detail.
last_delivered_at
string | null
β
When it was last delivered/used (if tracked)
created_at
string
β
ISO timestamp
updated_at
string
β
ISO timestamp
Decryption + Verification
What is encrypted?
contentis always encryptedfile_pathis encrypted only whentype = "file", otherwise it will benull
What you need to decrypt
Decrypt
data.contentusing the same secret you used when creating the injectableIf
data.file_pathis notnull, decrypt it using the same secret
Integrity verification (VERY IMPORTANT)
After decrypting content, verify both:
1) Content hash check
Compute:
hash('sha256', plaintext_content)β must equaldata.content_hash
2) Signature check
Compute:
hash_hmac('sha256', plaintext_content, secret)β must equaldata.signature
If either fails: treat the payload as invalid and donβt apply it.
Decryption Implementation
Below is the decryption algorithm your SDKs use, explained and then implemented for common languages.
Encrypted format
The encrypted payload is:
Base64 string (what you receive from API)
After base64 decode β a string shaped like:
iv::cipherText
Where:
iv= initialization vector (raw string)cipherText= encrypted text
Cipher details
Cipher:
AES-256-CBCKey normalization:
normalizedKey = SHA256(secret)as raw bytesDecrypt:
AES-256-CBC(cipherText, normalizedKey, iv)
The decryption and verification examples shown above are reference implementations provided to help you understand how DevPayr secures injectable payloads.
You are not required to use these exact snippets or the same libraries. You may freely adapt the logic to any programming language or framework of your choice, as long as the following rules are respected:
The encrypted fields (
contentandfile_path, when present) are decrypted using the same secret you supplied when creating the injectableThe decrypted payload must produce the same
content_hash(SHA-256) returned in the responseThe computed HMAC-SHA256 signature using the decrypted content and your secret must match the returned
signature
If all checks pass, the payload is guaranteed to be:
Untampered
Authentically generated by DevPayr
Exactly the same content you originally uploaded
This design ensures DevPayr remains SDK-agnostic, secure, and fully interoperable with any stack β whether you are using one of our SDKs or working directly with raw HTTP.
If you need help adapting this logic to another language, our SDKs and examples are a good reference point, but the cryptographic process itself remains universal.
Last updated