A scripted REST API in ServiceNow exposes custom operations through resources that define a method and request-processing script. Create the parent API, add a resource, then configure authentication and endpoint ACLs. Review resource overrides and path-based rules together before testing access with the intended integration user.
Plan a resource around one operation
Start with the operation the caller needs: for example, retrieving a limited status summary for an external application. Write down the accepted inputs, the intended response, and who should receive it. This gives the resource a clear boundary before you choose its name or write its script.
The parent API groups resources and supplies default settings. A resource defines its method and processing behavior, and can override settings from that parent. Keep a small design record showing which settings a resource inherits and which ones it changes. Otherwise, a later security review can miss an exception hidden below an apparently restricted API.
Choose a custom resource because the operation needs a defined contract or processing logic. If the requirement is primarily table access, compare the Table API endpoint format before adding another custom interface. This comparison helps keep the resource focused on behavior that deserves its own implementation.
Create the scripted REST API in ServiceNow
Creating the API requires the web_service_admin role. Navigate to All > System Web Services > Scripted REST APIs and click New. Enter a Name. The API ID is populated from that name, and you can change it if needed. Decide on that identifier before sharing the interface with consumers.
Use Default ACLs to select the endpoint access rules for resources in the API, then click Submit. Select ACLs with Type REST_Endpoint. A requesting user needs to satisfy at least one of the selected default ACLs; selecting several does not mean that the caller must satisfy them all.
That selection behavior matters when designing access. Adding a broadly available ACL beside a narrowly restricted one can admit callers through the broader rule. Review each selected ACL on its own terms, because any one of them can admit a caller.
After creating the parent, keep its purpose distinct from individual resource behavior. For the surrounding design decisions, use the guide to building, securing, and versioning scripted REST APIs. Here, the immediate goal is a resource whose access settings can be explained and tested.
Add the resource and define its processing
Creating a resource requires web_service_admin and an existing scripted REST API. Open the parent API record. In the Resources related list, click New and enter a Name. The resource name affects the request URI, so choose it deliberately and review the resulting resource location before giving it to callers.
- Select the HTTP method the operation implements, such as GET.
- Use the Script field to define how the operation interprets requests and constructs responses.
- Review whether security settings or valid content types need to differ from the parent.
- Optional: on the Documentation tab, add a Short description that explains how to access the resource.
- Click Submit to create the resource.
The Short description appears when the resource is explored through REST API Explorer. Make it operational: explain what the caller provides and what the operation returns. Avoid a description that repeats the resource name without helping someone form a valid request.
Before testing, review the script against the intended contract. Decide how it should handle absent inputs, unexpected values, and requests for data outside the intended scope. These are implementation decisions to settle explicitly. A working response to one valid request does not establish how the resource behaves when those assumptions fail.
Headers and query parameters can be associated after the resource is created. Keep those associations consistent with what the script actually accepts. When the contract needs a separate description for consumers, consider the related guidance on OpenAPI for scripted REST APIs.
Set authentication and resource ACL overrides
Configuring an individual resource to require an ACL requires web_service_admin or admin. Open the resource from the parent API’s Resources related list, then use the Security tab. Select Requires authentication before selecting Requires ACL authorization. The referenced resource ACL checks apply to authenticated users.
In the ACL field, choose rules with Type REST_Endpoint. Selecting ACLs here overrides the ACLs selected for the parent web service. Leaving this field empty uses the parent’s selected ACLs. Record the reason for an override so a maintainer can tell whether it is an intentional exception.
Clearing Requires authentication makes the resource public and removes the credential requirement, even when the parent REST service requires an ACL. Do not use that change as a shortcut around a failed authenticated test. First determine whether the failure comes from the caller’s identity, the selected endpoint ACLs, or access to the requested data.
Requests also respect platform ACLs, and callers must meet applicable table ACL requirements to access instance data. Endpoint authorization and data access therefore need separate checks. A caller passing an endpoint rule does not by itself demonstrate that the caller can obtain the intended records.
For a wider review of authentication and scope decisions, see API access policies for REST and SOAP. Keep the resource review specific: identify its authentication setting, its inherited or overridden ACLs, and the data permissions the request needs.
For a resource that inherits its endpoint ACLs, include the parent selection in the access review. For a resource with its own ACL selection, review that selection instead. Keep this distinction visible in the test record: otherwise, changing the parent can look like a fix even though the resource still uses its override. Check the authentication setting first, since operation-referenced ACLs are checked only for authenticated requests.
Add a path-based rule where the resource needs one
Adding a path-based ACL requires security_admin or admin. You also need the complete resource path from the Resource path field on the API’s SysWS operation record. Copy that value for the rule instead of reconstructing the path from a display name.
Navigate to All > sys_security_acl.list and select New. Set Type to REST Endpoint. In Operation, select the relevant method, such as GET, POST, PUT, DELETE, or PATCH. Enter the complete path in Resource Path, then configure the ACL script or condition to express the access requirement and submit the record.
A path-based ACL is evaluated for requests matching its resource path, including requests without authentication. It works alongside operation-referenced ACLs. All applicable ACLs must pass. This differs from the choice among multiple default ACLs on the parent API, where satisfying one selected rule is sufficient.
This approach can help when access rules must be added without changing the original API record, including a read-only API. It can also support controlled guest access. Treat those as reasons to design a rule carefully, not as evidence that a public resource is adequately restricted merely because a path rule exists.
For help planning this work, see ServiceNow implementation.
Test the access boundary before handing over the resource
Before testing, confirm the resource’s authentication setting and whether its endpoint ACLs come from the parent API or a resource override. Use a test record containing data suitable for validation, then exercise the resource with identities that represent its intended access boundary.
- An intended integration user should obtain the expected response for a valid request.
- An authenticated user without the required endpoint access should fail the relevant authorization check.
- A caller without credentials should behave according to the resource’s authentication setting and applicable path-based rules.
- A caller requesting restricted table data should remain subject to the applicable data-access requirements.
Capture the identity, method, resource path, input, and observed response for each test. When a result differs from the design, inspect the configuration layer responsible for that decision before changing another layer. Retest inherited and overridden resources separately; they may share a parent while using different endpoint ACL selections.
Questions about maintaining resource access
Can I introduce a new contract without replacing the earlier version?
A versioned scripted REST API can have an additional version with different behavior. Adding a version requires web_service_admin and an API with versioning already enabled. Plan consumer migration separately from creating that new version.
What changes when versioning has no default version?
Enabling versioning requires web_service_admin. Under Related Links, select Enable versioning. If Make version v1 default is cleared and no default is configured, callers must use a version-specific URI. Check consumer requests before choosing that arrangement.
The default setting and the existence of a version are separate choices. After enabling versioning, the Versioning list on the service form lets you add versions and control the default. In the handover, identify which version consumers should request and whether they must include it in the URI. This makes the caller’s request format an explicit part of the agreement.
Must I recreate resources when adding a version?
The Add new version dialog offers Copy existing resources from version. Select an existing version to copy its resources into the new one. Review the copied resources against the new contract and rerun access tests before directing consumers to them.
Can a new version become the default during creation?
Yes. Under Related Links, choose Add new version and select Make this version the default if that is the intended behavior. Treat the default choice as a consumer-facing decision and include affected integrations in the release review.