Create an injectable

Create a new injectable under a project.

An injectable is a unit of payload DevPayr can later deliver to your SDK/runtime (for example: a script snippet, config JSON, or a file-based payload), based on your project rules.


Endpoint

POST /project/{project}/injectables

Full URL:

https://api.devpayr.dev/api/v1/project/{project}/injectables

Authentication

βœ… Required: API Key

X-API-KEY: <your_api_key>

Content Type

This endpoint accepts multipart/form-data because you may optionally upload a file.

  • If type = file β†’ send a file

  • Otherwise β†’ send content as text


Path Parameters

Parameter
Type
Required
Description

project

integer

Yes

The ID of the project to attach the injectable to.

Request Fields

Required fields (always)

Field
Type
Required
Description

type

string

Yes

The injectable type. See allowed values below.

mode

string

Yes

How the injectable should be applied. See allowed values below.

target_path

string

Yes

The destination path this injectable targets.

secret

string

Yes

A secret used to protect the injectable payload. Must be at least 8 characters.

only_if_paid

boolean

Yes

If true, the injectable should only apply when the project is marked as paid.

is_active

boolean

Yes

Whether this injectable is enabled.

Optional fields

Field
Type
Required
Description

title

string

No

Human-friendly name.

slug

string

No

Unique identifier within the project. If omitted, DevPayr generates one.

validate_endpoint

string (url)

No

Optional URL your SDK/runtime may call to check whether to apply the injectable.

Payload fields (choose one)

Field
Type
Required
When

content

string

Yes

Required unless type = file

file

file (binary)

Yes

Required if type = file (max 5MB)

Allowed values

type allowed values

file, snippet, html, script, component, config, json, markdown, css, include, sdk_module, docs, template

mode allowed values

inject, write, replace, symlink, append, prepend, mount, inline_render, stream

Example Requests

Validation Rules

  • file is required only when type = file (max size 5MB).

  • content is required when type != file.

  • secret must be at least 8 characters.

  • slug must be unique within the project.

Common Errors

Unauthorized / wrong project access (403)

Validation failed (422)

Example cases:

  • missing content for non-file injectables

  • missing file for file injectables

  • invalid type or mode

  • file too large

  • duplicate slug in the same project

Typical response:

Rate limited (429)

Last updated