@archastro/sdk
    Preparing search index...
    Index

    Constructors

    Methods

    • Archive an artifact Soft-deletes the artifact identified by artifact. The artifact record is retained in storage but is no longer returned by the list or show endpoints. The authenticated user must have write access to the artifact's owning team or organization. Attempting to archive an artifact you do not own returns 403. Attempting to archive an artifact that does not exist or is already archived returns 404.

      Parameters

      • artifact: string

        Artifact ID (art_...) of the artifact to archive.

      Returns Promise<void>

      Returns 204 No Content on success. The artifact is soft-deleted and no longer accessible through the API.

    • Retrieve raw artifact file content Returns the raw binary content of the file stored for the specified artifact. The response Content-Type header reflects the artifact file's MIME type, so you can pipe the response body directly to disk or display it in a browser. By default the endpoint serves the artifact's current version. Pass the version parameter to retrieve a specific historical version. The authenticated user must have read access to the artifact's owning team or organization.

      Parameters

      • artifact: string

        Artifact ID (art_...) of the artifact whose content to retrieve.

      • Optionalparams: { version?: number }

        Query parameters.

        • Optionalversion?: number

          Version number to retrieve. Omit to return the artifact's current version.

      Returns Promise<{ content: ArrayBuffer; mimeType: string }>

      Raw binary content of the artifact file. The Content-Type header is set to the artifact's stored MIME type.

    • Create an artifact Creates a new artifact and stores its file content. A file payload is required; supply it via the file.data (Base64-encoded by default), file.filename, and file.mime_type fields. The artifact is scoped to the owner resolved from the request body — either a team, a user, or an explicit system owner. When no owner is supplied and the viewer is an authenticated user, the artifact defaults to that user. For company-readable snapshots, pass system: true and org. Organization members can read these artifacts; organization admins and system viewers can create them. Scripts may supply text directly using file.encoding: "utf8". Optionally associate the artifact with an existing thread or agent by passing thread or agent. Legacy requests that wrap fields in an artifact object are still accepted.

      Parameters

      • input: {
            agent?: string;
            artifact?: Record<string, unknown>;
            description?: string;
            file?: {
                data: string;
                encoding?: "base64" | "utf8";
                filename?: string;
                mime_type?: string;
            };
            group_key?: string
            | null;
            idempotency_key?: string;
            name?: string;
            org?: string;
            permissions?: Record<string, unknown>;
            system?: boolean;
            team?: string;
            thread?: string;
            user?: string;
        }

        Request body.

        • Optionalagent?: string

          Agent ID (agt_...) to associate with the artifact.

        • Optionalartifact?: Record<string, unknown>

          Legacy wrapper object containing artifact attributes. Prefer top-level fields.

        • Optionaldescription?: string

          Optional longer artifact description.

        • Optionalfile?: {
              data: string;
              encoding?: "base64" | "utf8";
              filename?: string;
              mime_type?: string;
          }

          File payload for the initial artifact version.

        • Optionalgroup_key?: string | null

          Optional nonunique, case-sensitive grouping key, limited to 1024 UTF-8 bytes. Artifact ID remains identity.

        • Optionalidempotency_key?: string

          Optional PR-evidence retry key, limited to 255 characters. Requires both team and thread. Matching app, team, thread, name, and key values return the original artifact.

        • Optionalname?: string

          Human-readable artifact name.

        • Optionalorg?: string

          Organization owning a system artifact. Requires an organization admin or system viewer.

        • Optionalpermissions?: Record<string, unknown>

          Optional artifact permissions map.

        • Optionalsystem?: boolean

          When true, create a system-owned artifact. Mutually exclusive with team and user.

        • Optionalteam?: string

          Team ID (tem_...) that should own the artifact. Mutually exclusive with user.

        • Optionalthread?: string

          Thread ID (thr_...) to associate with the artifact.

        • Optionaluser?: string

          User ID (usr_...) that should own the artifact. Defaults to the authenticated user when omitted and no team is supplied.

      Returns Promise<Artifact>

      The newly created artifact.

    • Delete an artifact Permanently deletes the artifact and all associated file versions. This operation is irreversible — deleted artifacts and their file content cannot be recovered. The authenticated user must have write access to the artifact's owning team or organization. Returns 404 if the artifact does not exist or is not accessible to the caller.

      Parameters

      • artifact: string

        Artifact ID (art_...) of the artifact to delete.

      Returns Promise<void>

      Empty body. HTTP 204 indicates the artifact and all associated file versions were permanently deleted.

    • Retrieve an artifact Returns the artifact identified by artifact. The response includes metadata such as name, description, version, and a signed file_url for downloading the current file version. Image artifacts also include an image_source object with display-ready metadata. The authenticated user must have read access to the artifact's owning team or organization. Returns 404 if the artifact does not exist or is not accessible to the caller.

      Parameters

      • artifact: string

        Artifact ID (art_...) of the artifact to retrieve.

      Returns Promise<Artifact>

      The requested artifact, including its current version's file metadata and signed download URL.

    • Update an artifact Updates the metadata and, optionally, the file content of an existing artifact. This endpoint uses optimistic concurrency control: you must supply the artifact's current version number as from_version. If another update has incremented the version since you last fetched the artifact, the request returns 409. To replace the artifact's file, include a nested file object with Base64 data, filename, and mime_type. Omitting file leaves the existing file unchanged. The authenticated user or developer must have write access to the artifact's owner.

      Parameters

      • artifact: string

        Artifact ID (art_...) of the artifact to update.

      • input: {
            description?: string;
            file?: {
                data: string;
                encoding?: "base64" | "utf8";
                filename?: string;
                mime_type?: string;
            };
            file_content?: string;
            file_content_type?: string;
            file_name?: string;
            from_version: number;
            group_key?: string
            | null;
            name?: string;
        }

        Request body.

        • Optionaldescription?: string

          New description for the artifact. Omit to leave the existing description unchanged.

        • Optionalfile?: {
              data: string;
              encoding?: "base64" | "utf8";
              filename?: string;
              mime_type?: string;
          }

          Replacement file payload. Omit to leave the current file unchanged.

        • Optionalfile_content?: string

          Legacy flat Base64 file content. Prefer file.data.

        • Optionalfile_content_type?: string

          Legacy flat MIME type. Prefer file.mime_type.

        • Optionalfile_name?: string

          Legacy flat filename. Prefer file.filename.

        • from_version: number

          The artifact's current version number, used for optimistic concurrency control. Returns 409 if this value does not match the server's current version.

        • Optionalgroup_key?: string | null

          Nonunique grouping key, limited to 1024 UTF-8 bytes. Omit to preserve; null clears. Grouping-only updates do not increment the content version and from_version does not protect against concurrent metadata updates.

        • Optionalname?: string

          New display name for the artifact. Omit to leave the existing name unchanged.

      Returns Promise<Artifact>

      The artifact after applying the update, reflecting the new version number and any changed metadata or file.