Optionally provide the API name, version, and description.
Creating API Specs with AI
The Generative API Specification feature unlocks AI capabilities for API design journeys by generating and mocking API specs from natural language. The feature reduces the time spent on API design by simplifying the creation of rigid, syntax-heavy specs. You can access the feature after creating an API project that’s in the supported RAML 1.0 or OAS 3.0 format or from the Open Agentforce icon within the project. The system supports multi-turn conversations and provides validated API specifications.
Before You Begin
Before you start creating your API spec:
-
Make sure you have the required Anypoint Code Builder permissions.
-
Make sure you have these permissions to use the Anypoint Code Builder Agentforce feature:
-
Anypoint Code Builder Developer
-
Mule Developer Generative AI User
-
-
Make sure Einstein is enabled in Access Management. For more information, see Enabling Einstein for Anypoint Platform.
-
Log in to Anypoint Code Builder with your Anypoint Platform credentials.
-
Create an API spec project in Anypoint Code Builder in the supported RAML 1.0 or OAS 3.0 format, and then select a business group. The business group must have Einstein generative AI enabled. If you don’t have Einstein generative AI after selecting a business group, contact your Anypoint Platform administrator to enable the feature.
Design an API Spec with AI
To design an API spec with AI, begin by reviewing the starter prompt for guidance on the context the agent needs.
-
Describe your API spec in the chat. The agent prompts you for clarification if it doesn’t understand your request.
Include these required details and consider including optional details to generate a more precise spec:
Base Details
Security Details
Include a required security scheme of type Oauth 1.0, Oauth 2.0, Basic Authentication, Digest Authentication, or Pass Through.
-
For Basic Authentication, Digest Authentication, or Pass Through, specify responses, query parameters, and headers.
-
For Oauth 1.0 or 2.0, specify responses, query parameters, headers, and settings.
-
Settings for Oauth 1.0 can be of type
authorizationUri
,requestTokenUri
,tokenCredentialsUri
, or signatures. -
Settings for Oauth 2.0 can be of type
authorizationUri
,requestTokenUri
, orauthorizationGrants
.
-
The following additional details apply:
Header Requirements
Headers must include the name, whether it’s required, and one of the following types:
-
Array
-
Boolean
-
Date only
-
DateTime
-
DateTime only
-
File
-
nil
-
Number
-
Object
-
String
-
Time only
Optionally, provide a description, format, minimum and maximum length, default value, and example for the header.
Query Parameter Requirements
Query parameters must include the name, whether it’s required, and one of the following types:
-
Array
-
Boolean
-
Date only
-
DateTime
-
DateTime only
-
File
-
nil
-
Number
-
Object
-
String
-
Time only
Optionally, provide a description, format, minimum and maximum length, default value, and example for the query parameter.
Response Requirements
Responses must include the status code and description.
Resources and Methods
Include a required security scheme of type Oauth 1.0, Oauth 2.0, Basic Authentication, Digest Authentication, or Pass Through.
The following additional details apply:
Resource Requirements
Each resource can include one or more of the following methods:
-
GET
-
POST
-
PUT
-
PATCH
-
DELETE
-
HEAD
-
OPTIONS
For GET and HEAD methods, you can include a summary, responses, requests, and query or header parameters.
For POST, PUT, PATCH, and OPTIONS methods, you can include a summary, responses, requests, body, and query or header parameters.
Response Requirements
Responses must include the status code and description. Response bodies are optional and can include a description, type, media type, and example.
Request Requirements
Requests must include a description and body.
Header Requirements
Headers must include the name, whether it’s required, and one of the following types:
-
Array
-
Boolean
-
Date only
-
DateTime
-
DateTime only
-
File
-
nil
-
Number
-
Object
-
String
-
Time only
Optionally, provide a description, format, minimum and maximum length, default value, and example for the header.
Query Parameter Requirements
Query parameters must include the name, whether it’s required, and one of the following types:
-
Array
-
Boolean
-
Date only
-
DateTime
-
DateTime only
-
File
-
nil
-
Number
-
Object
-
String
-
Time only
Optionally, provide a description, format, minimum and maximum length, default value, and example for the query parameter.
-
-
Send your message. The agent creates a validated API spec.
Governance isn’t included in the validation. |
-
Review the spec and continue the conversation if you’d like to make changes.
-
Click Replace to add the generated API spec to your project. All file content is replaced by the inserted code.
You can also copy the generated API spec to your clipboard by clicking Copy.
Give Feedback on Agent Responses
Share your feedback about the agent’s response by clicking thumbs up or thumbs down.
View Conversation History
To view your past conversations, click Open chat history. Your last 30 days of conversations show.
Start a New Chat
You can only create an API spec if you have a project open in the supported RAML 1.0 or OAS 3.0 format. Click Create API Spec from the New Chat dropdown to create a new API spec.
The option doesn’t show for projects that aren’t in the supported format.