Skip to main content
POST
Upload knowledge file

Restrictions

Usage

  • The file body is sent as base64 text in content_b64 — this is not a multipart upload. Writing an existing rel_path overwrites it.
  • Limits: each file at most 1 MiB (DUTY.md at most 32 KiB), at most 100 files and 5 MiB in total per knowledge. Content must be UTF-8 text without NUL bytes. Violations, as well as invalid rel_path values, return InvalidParameter.
  • Pass expected_version (from a previous read or write) to write only if nobody changed the knowledge since; on mismatch the call returns HTTP 200 with status = conflict and writes nothing.
  • Every successful write increases the knowledge version by 1; writing DUTY.md also updates duty_version.
  • Editing account knowledge requires the account owner or an admin; editing team knowledge requires membership of that team.
  • Every call is recorded in the account audit log.

Authorizations

app_key
string
query
required

APP Key created in the Flashduty console under My → APP Key. Send it as the app_key query parameter or in the Fd-App-Key request header. Its effective access is the intersection of the key's permission scope and the creator's current role permissions. Keep it secret.

Body

application/json

File to create or overwrite. The body is base64 text in content_b64, not a multipart upload.

rel_path
string
required

Destination path relative to the knowledge root; an existing file at this path is overwritten. Must use / separators, must not start with /, must already be in normalized form, and no segment may be empty, ., .., or start with . (dotfiles are rejected).

pack_id
string

Knowledge ID; defaults to the caller's account-scope knowledge.

content_b64
string

Base64-encoded (standard alphabet) file content. The decoded bytes must be UTF-8 text with no NUL bytes and at most 1 MiB (DUTY.md: at most 32 KiB). Omit or send an empty string to write an empty file.

content_type
string

MIME type to store with the file. Optional: when omitted it is derived from the extension of rel_path (.md → text/markdown, .yaml/.yml → text/yaml, .json → application/json, .sh → text/x-sh, otherwise text/plain). Any value passed is stored as given.

expected_version
integer
default:0

Optimistic-concurrency guard. 0 or omitted: write unconditionally. A positive value: write only if the knowledge's current version equals it; otherwise nothing is written and the call returns HTTP 200 with status = conflict and the current version.

Required range: x >= 0

Response

Success

Standard response envelope used by every Flashduty public API. On success data contains the endpoint-specific payload and error is absent. On failure error is present and data is absent. request_id is always present and is also mirrored in the Flashcat-Request-Id response header.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

error
object

Error payload inside the response envelope. Present only on non-2xx responses.

data
object

Write result. On success carries the written file; on a version conflict carries only status, version and message.