API Reference > imodeljs-common > Codes > CodeSpec CodeSpec Class A Code Specification captures the rules for encoding and decoding significant business information into and from a Code (string). This specification is used to generate and validate Codes. A CodeSpec defines the format of a Code for a certain type of Element in an IModel. A CodeSpec can identify an external system that maintains and/or assigns Codes. Methods Name Description create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec Static Create a new CodeSpec from the specified parameters Properties Name Type Description id string The id of this CodeSpec. iModel IModel The iModel holding this CodeSpec. isManagedWithIModel Accessor boolean Will be true if the codes associated with this CodeSpec are managed along with the iModel and false if the codes are managed by an external service. isValid Accessor ReadOnly boolean Will be true if the id of this CodeSpec is valid. name string The name of this CodeSpec. scopeReq Accessor CodeScopeSpec.ScopeRequirement Will be CodeScopeSpec.ScopeRequirement.FederationGuid if the scoping element is required to have a FederationGuid or CodeScopeSpec.ScopeRequirement.ElementId otherwise (which is the default). scopeType Accessor CodeScopeSpec.Type The scope type of this CodeSpec. specScopeType Accessor CodeScopeSpec.Type The scope type of this CodeSpec. Defined in core/common/src/Code.ts Line 232 Last Updated: 11 June, 2024