Skip to main content
It is not recommended to migrate or reformat your existing scripts to the new scripting APIs at this time. Upcoming updates are expected to introduce breaking changes as we continue to refine and improve the scripting experience.The current rollout is intentionally gradual, allowing us to gather user feedback and iterate based on real-world usage.All further updates to scripting will be scoped to the experimental scripting sandbox, which is the default, and the preference can be updated from Settings → Experiments.Your feedback will be invaluable as we shape the next generation of Auk scripting.
This new experimental implementation provides a robust foundation for API scripting with enhanced capabilities for environment management, request manipulation, response processing, cookie handling, and comprehensive testing. The new system maintains backwards compatibility while introducing powerful new features for modern API testing workflows.

hopp.env Namespace

Environment variable management with scope-specific operations and enhanced functionality.

hopp.env.get(key: string)

Retrieves the value of the selected environment’s variable. Accepts an environment variable as an argument.

hopp.env.getRaw(key: string)

Retrieves the raw value of the selected environment’s variable without variable resolution.

hopp.env.set(key: string, value: string)

Sets the value of an environment variable in the selected environment.

hopp.env.delete(key: string)

Deletes an environment variable from the selected environment.

hopp.env.reset(key: string)

Resets an environment variable to its initial value in the selected environment.

hopp.env.getInitialRaw(key: string)

Retrieves the initial raw value of an environment variable.

hopp.env.setInitial(key: string, value: string)

Sets the initial value of an environment variable.

Active Environment Scope

Operations specific to the currently active environment.

hopp.env.active.get(key: string)

Retrieves the value of the active environment’s variable.

hopp.env.active.getRaw(key: string)

Retrieves the raw value of the active environment’s variable.

hopp.env.active.set(key: string, value: string)

Sets the value of an active environment variable.

hopp.env.active.delete(key: string)

Deletes a variable from the active environment.

hopp.env.active.reset(key: string)

Resets a variable in the active environment to its initial value.

hopp.env.active.getInitialRaw(key: string)

Retrieves the initial raw value of an active environment variable.

hopp.env.active.setInitial(key: string, value: string)

Sets the initial value of an active environment variable.

Global Environment Scope

Operations specific to the global environment.

hopp.env.global.get(key: string)

Retrieves the value of the global environment’s variable.

hopp.env.global.getRaw(key: string)

Retrieves the raw value of the global environment’s variable.

hopp.env.global.set(key: string, value: string)

Sets the value of a global environment variable.

hopp.env.global.delete(key: string)

Deletes a variable from the global environment.

hopp.env.global.reset(key: string)

Resets a variable in the global environment to its initial value.

hopp.env.global.getInitialRaw(key: string)

Retrieves the initial raw value of a global environment variable.

hopp.env.global.setInitial(key: string, value: string)

Sets the initial value of a global environment variable.

hopp.request Namespace

Request manipulation with immutable properties and dedicated mutation functions.

Read-only Properties

hopp.request.url

The request URL as a string.

hopp.request.method

The HTTP method of the request.

hopp.request.params

The query parameters of the request.

hopp.request.headers

The headers of the request.

hopp.request.body

The body of the request.

hopp.request.auth

The authentication configuration of the request.

Mutation Functions (Pre-request Phase Only)

hopp.request.setUrl(url: string)

Sets the request URL.

hopp.request.setMethod(method: string)

Sets the HTTP method of the request.

hopp.request.setHeader(name: string, value: string)

Sets a header on the request.

hopp.request.setHeaders(headers: HoppRESTHeader[])

Sets multiple headers on the request.

hopp.request.removeHeader(name: string)

Removes a header from the request.

hopp.request.setParam(name: string, value: string)

Sets a query parameter on the request.

hopp.request.setParams(params: HoppRESTParam[])

Sets multiple query parameters on the request.

hopp.request.removeParam(name: string)

Removes a query parameter from the request.

hopp.request.setBody(body: Partial<HoppRESTReqBody>)

Sets the body of the request.

hopp.request.setAuth(auth: Partial<HoppRESTAuth>)

Sets the authentication for the request.

Request Variables

hopp.request.variables.get(key: string)

Retrieves the value of a request variable.

hopp.request.variables.set(key: string, value: string)

Sets the value of a request variable.
Please note that only updates to request variables get persisted and reflected in the UI while the remaining are specific to the session.

hopp.response Namespace

Response access with multiple data formats and comprehensive metadata.

Response Metadata

hopp.response.statusCode

The HTTP status code of the response.

hopp.response.statusText

The status text of the response.

hopp.response.headers

The headers of the response.

hopp.response.responseTime

The response time in milliseconds.

Response Body Access Methods

hopp.response.body.asJSON()

Parses the response body as JSON.

hopp.response.body.asText()

Returns the response body as text.

hopp.response.body.bytes()

Returns the response body as a Uint8Array.

hopp.cookies Namespace

Domain-aware cookie management with comprehensive CRUD operations.

hopp.cookies.get(domain: string, cookieName: string)

Retrieves a cookie by domain and name.
Sets a cookie for a domain.

hopp.cookies.has(domain: string, cookieName: string)

Checks if a cookie exists for a domain.

hopp.cookies.getAll(domain: string)

Retrieves all cookies for a domain.

hopp.cookies.delete(domain: string, cookieName: string)

Deletes a cookie for a domain.

hopp.cookies.clear(domain: string)

Clears all cookies for a domain.

hopp.test and hopp.expect Testing Framework

Comprehensive testing API with custom assertions and Chai.js-powered BDD assertions for advanced API testing.

hopp.test(testName: string, testFunction: () => void)

Creates a group of tests with a name.

hopp.expect(actual: any)

Returns an expectation object for assertions. Auk extends the testing framework with comprehensive Chai.js BDD assertion support, enabling advanced testing patterns with 50+ assertion methods.

Basic Custom Assertions

hopp.expect(value).toBe(expected: any)

Tests for exact equality.

hopp.expect(value).toBeType(type: string)

Tests for type equality.

hopp.expect(value).toHaveLength(number: number)

Tests that a value has a specific length.

hopp.expect(value).toInclude(item: any)

Tests that a value includes an item.

HTTP Status Code Level Assertions

hopp.expect(statusCode).toBeLevel2xx()

Tests that the status code is in the 2xx range.

hopp.expect(statusCode).toBeLevel3xx()

Tests that the status code is in the 3xx range.

hopp.expect(statusCode).toBeLevel4xx()

Tests that the status code is in the 4xx range.

hopp.expect(statusCode).toBeLevel5xx()

Tests that the status code is in the 5xx range.

Negation Support

All assertions support .not for negation.

Chai.js Assertion Support

Auk includes comprehensive Chai.js BDD assertion support through hopp.expect() for native scripts and pm.expect() for Postman compatibility, enabling advanced testing patterns with 50+ assertion methods.

Type Assertions

Check value types and instances:

Equality Assertions

Test for strict and deep equality:

Property Assertions

Validate object properties and nested structures:

Collection and Array Assertions

Validate arrays and collections:

Numeric Comparisons

Perform numeric comparisons and range checks:

String Assertions

Validate string content and patterns:

Boolean State Assertions

Check boolean values and states:

Complex Assertion Chains

Combine multiple assertions for comprehensive validation:

Real-World Example: API Pagination

Complete Assertion Reference

Type assertions:
  • .a(type) / .an(type) - Check value type
  • .instanceof(constructor) - Check instance type
Equality assertions:
  • .equal(value) / .eq(value) - Strict equality (===)
  • .eql(value) - Deep equality
Property assertions:
  • .property(name) - Has property
  • .own.property(name) - Has own property (not inherited)
  • .nested.property(path) - Has nested property (e.g., ‘a.b.c’)
Collection assertions:
  • .include(value) / .contain(value) - Contains value
  • .members(array) - Has members (order-independent)
  • .ordered.members(array) - Has members in order
  • .keys(...keys) - Has keys
  • .lengthOf(n) - Length equals n
  • .lengthOf.at.least(n) - Minimum length
  • .lengthOf.at.most(n) - Maximum length
Comparison assertions:
  • .above(n) / .gt(n) - Greater than
  • .below(n) / .lt(n) - Less than
  • .at.least(n) / .gte(n) - Greater than or equal
  • .at.most(n) / .lte(n) - Less than or equal
  • .within(min, max) - Within range
  • .closeTo(expected, delta) - Approximately equal
Boolean assertions:
  • .ok - Truthy
  • .true - Strictly true
  • .false - Strictly false
  • .null - Strictly null
  • .undefined - Strictly undefined
  • .exist - Not null or undefined
  • .empty - Empty (string, array, object)
String assertions:
  • .match(regex) - Matches regular expression
  • .string(substring) - Contains substring
Function assertions:
  • .throw() / .throw(ErrorType) - Throws error
  • .respondTo(method) - Has method
Object state assertions:
  • .extensible - Object.isExtensible()
  • .sealed - Object.isSealed()
  • .frozen - Object.isFrozen()
Modifiers:
  • .not - Negation
  • .deep - Deep comparison
  • .own - Own properties only
  • .ordered - Order matters
  • .nested - Nested property access
  • .all - All items/keys
  • .any - Any items/keys
  • .to / .be / .is / .that / .and / .have / .with - Language chains for readability

pm Namespace - Postman Compatibility Layer

Postman API compatibility for seamless migration with experimental Postman collection import support (v2.0/v2.1). The pm namespace provides pm.expect() with full Chai.js assertion support for Postman-compatible testing.
Experimental Script Import: When importing Postman collections, Auk can now import pre-request scripts and test scripts (experimental feature requiring user consent). This enables you to migrate your existing Postman workflows including their scripting logic.

Core APIs

Postman Chai.js Assertions

Use pm.expect() with full Chai.js BDD assertion support for Postman-compatible scripts:

Postman Response Assertions

Postman-specific response validation methods:

OAuth Token Handling Example

PM-Specific Response Assertions

The following assertions are specific to the Postman compatibility layer:
  • pm.response.to.have.status(code) - Status code check
  • pm.response.to.have.header(name) - Header existence
  • pm.response.to.have.body() - Has response body
  • pm.response.to.have.jsonBody() - JSON body exists
  • pm.response.to.have.jsonBody(path) - JSON property exists
  • pm.response.to.have.jsonSchema(schema) - Validates JSON schema
  • pm.response.to.be.ok - 2xx status code
  • pm.response.to.be.success - Alias for ok
  • pm.response.to.be.json - JSON content type

Sending Requests

The pm.sendRequest method allows you to send HTTP requests asynchronously from your scripts. This is useful for chaining requests or fetching data from other APIs.
It is recommended to use the Agent interceptor on the Web App and the Native interceptor on the Desktop App for fetch(), hopp.fetch() and pm.sendRequest() usages.

Unsupported Postman Features

The following Postman features are not currently supported:
  • pm.visualizer
  • pm.collectionVariables
  • pm.iterationData
  • pm.execution.setNextRequest()
  • Legacy patterns like global responseBody variable, require(), etc.
These limitations are documented in error messages when attempting to use unsupported APIs. The supported version range for Postman collections is v2.0/v2.1.

pw Namespace - Legacy Compatibility

Maintained for backwards compatibility with existing scripts:
Cookies are represented as objects with the following properties:

Usage Examples

Environment Management

Request Manipulation

Response Testing

Scripts

Read about pre-request scripts.

Tests

Read about post-request tests.

Environments

Read about environments.